// Path: phpbb-parser/src/net/kulak/psy/data/schema/Payload.java
// @XmlRootElement
// public class Payload {
// 
// 	@Override
// 	public String toString() {
// 		return "Payload [topicId=" + topicId + ", sequence="
// 				+ sequence + ", timestamp="
// 				+ TIMESTAMP_FORMAT.format(timestamp) + ", type=" + type
// 				+ ", value=" + value + "]";
// 	}
// 
// 	public String getTopicId() {
// 		return topicId;
// 	}
// 
// 	public void setTopicId(String topicId) {
// 		this.topicId = topicId;
// 	}
// 
// 	public Integer getSequence() {
// 		return sequence;
// 	}
// 
// 	public void setSequence(Integer sequence) {
// 		this.sequence = sequence;
// 	}
// 
// 	public Date getTimestamp() {
// 		return timestamp;
// 	}
// 
// 	public void setTimestamp(Date timestamp) {
// 		this.timestamp = timestamp;
// 	}
// 
// 	public String getType() {
// 		return type;
// 	}
// 
// 	public void setType(String type) {
// 		this.type = type;
// 	}
// 
// 	public String getValue() {
// 		return value;
// 	}
// 
// 	public void setValue(String value) {
// 		this.value = value;
// 	}
// 
// 	private final static DateFormat TIMESTAMP_FORMAT = SimpleDateFormat
// 			.getDateTimeInstance(SimpleDateFormat.SHORT, SimpleDateFormat.SHORT);
// 
// 	private String topicId;
// 	private Integer sequence;
// 	private Date timestamp;
// 	private String type;
// 	private String value;
// }


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.regex.Pattern;
import net.kulak.psy.data.schema.Payload;
package net.kulak.psy.semantic;



public class RegexpInteractionAnalyzer extends InteractionAnalyzer {

	private List<Pattern> patternsPositive = new ArrayList<Pattern>();
	private List<Pattern> patternsNegative = new ArrayList<Pattern>();
	private List<Pattern> patternsExtremelyNegative = new ArrayList<Pattern>();

	private void readPatterns(String resource, List<Pattern> target) throws IOException {
		BufferedReader br = null;
		try {
			br = new BufferedReader(new FileReader(
					getClass().getResource(resource).getFile()
				));
			String pattern;
			while ((pattern = br.readLine()) != null) {
				target.add(Pattern.compile(pattern));
			}
		} finally {
			if (br != null) {
				br.close();
			}
		}
	}

	public RegexpInteractionAnalyzer() throws IOException {
		readPatterns("/net/kulak/psy/semantic/semantic-positive.txt", patternsPositive);
		readPatterns("/net/kulak/psy/semantic/semantic-negative.txt", patternsNegative);
		readPatterns("/net/kulak/psy/semantic/semantic-extremely-negative.txt", patternsExtremelyNegative);
	}

	public Payload analyze(String text) {
// Path: phpbb-parser/src/net/kulak/psy/data/schema/Payload.java
// @XmlRootElement
// public class Payload {
// 
// 	@Override
// 	public String toString() {
// 		return "Payload [topicId=" + topicId + ", sequence="
// 				+ sequence + ", timestamp="
// 				+ TIMESTAMP_FORMAT.format(timestamp) + ", type=" + type
// 				+ ", value=" + value + "]";
// 	}
// 
// 	public String getTopicId() {
// 		return topicId;
// 	}
// 
// 	public void setTopicId(String topicId) {
// 		this.topicId = topicId;
// 	}
// 
// 	public Integer getSequence() {
// 		return sequence;
// 	}
// 
// 	public void setSequence(Integer sequence) {
// 		this.sequence = sequence;
// 	}
// 
// 	public Date getTimestamp() {
// 		return timestamp;
// 	}
// 
// 	public void setTimestamp(Date timestamp) {
// 		this.timestamp = timestamp;
// 	}
// 
// 	public String getType() {
// 		return type;
// 	}
// 
// 	public void setType(String type) {
// 		this.type = type;
// 	}
// 
// 	public String getValue() {
// 		return value;
// 	}
// 
// 	public void setValue(String value) {
// 		this.value = value;
// 	}
// 
// 	private final static DateFormat TIMESTAMP_FORMAT = SimpleDateFormat
// 			.getDateTimeInstance(SimpleDateFormat.SHORT, SimpleDateFormat.SHORT);
// 
// 	private String topicId;
// 	private Integer sequence;
// 	private Date timestamp;
// 	private String type;
// 	private String value;
// }


// Path: phpbb-parser/src/net/kulak/psy/semantic/RegexpInteractionAnalyzer.java
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.regex.Pattern;
import net.kulak.psy.data.schema.Payload;

package net.kulak.psy.semantic;



public class RegexpInteractionAnalyzer extends InteractionAnalyzer {

	private List<Pattern> patternsPositive = new ArrayList<Pattern>();
	private List<Pattern> patternsNegative = new ArrayList<Pattern>();
	private List<Pattern> patternsExtremelyNegative = new ArrayList<Pattern>();

	private void readPatterns(String resource, List<Pattern> target) throws IOException {
		BufferedReader br = null;
		try {
			br = new BufferedReader(new FileReader(
					getClass().getResource(resource).getFile()
				));
			String pattern;
			while ((pattern = br.readLine()) != null) {
				target.add(Pattern.compile(pattern));
			}
		} finally {
			if (br != null) {
				br.close();
			}
		}
	}

	public RegexpInteractionAnalyzer() throws IOException {
		readPatterns("/net/kulak/psy/semantic/semantic-positive.txt", patternsPositive);
		readPatterns("/net/kulak/psy/semantic/semantic-negative.txt", patternsNegative);
		readPatterns("/net/kulak/psy/semantic/semantic-extremely-negative.txt", patternsExtremelyNegative);
	}

	public Payload analyze(String text) {
		Payload res = new Payload();