Search in sources :

Example 6 with StopRecognition

use of org.ansj.recognition.impl.StopRecognition in project ansj_seg by NLPchina.

the class StopLibrary method insertStopRegexes.

/**
	 * 正则过滤
	 * 
	 * @param key
	 * @param regexes
	 */
public static void insertStopRegexes(String key, String... regexes) {
    StopRecognition fr = get(key);
    fr.insertStopRegexes(regexes);
}
Also used : StopRecognition(org.ansj.recognition.impl.StopRecognition)

Example 7 with StopRecognition

use of org.ansj.recognition.impl.StopRecognition in project ansj_seg by NLPchina.

the class StopLibrary method insertStopWords.

/**
	 * 增加停用词
	 * 
	 * @param key
	 * @param regexes
	 */
public static void insertStopWords(String key, List<String> stopWords) {
    StopRecognition fr = get(key);
    fr.insertStopWords(stopWords);
}
Also used : StopRecognition(org.ansj.recognition.impl.StopRecognition)

Example 8 with StopRecognition

use of org.ansj.recognition.impl.StopRecognition in project ansj_seg by NLPchina.

the class StopLibrary method insertStopWords.

/**
	 * 增加停用词
	 * 
	 * @param key
	 * @param regexes
	 */
public static void insertStopWords(String key, String... stopWords) {
    StopRecognition fr = get(key);
    fr.insertStopWords(stopWords);
}
Also used : StopRecognition(org.ansj.recognition.impl.StopRecognition)

Example 9 with StopRecognition

use of org.ansj.recognition.impl.StopRecognition in project ansj_seg by NLPchina.

the class AppTest method main.

public static void main(String[] args) throws IOException {
    String stopDicStr = "6\n7\n龙";
    StopRecognition testFilter = new StopRecognition();
    BufferedReader br = new BufferedReader(new StringReader(stopDicStr));
    String temp = null;
    while ((temp = br.readLine()) != null) {
        testFilter.insertStopWords(temp);
    }
    List<StopRecognition> filters = new ArrayList<StopRecognition>();
    filters.add(testFilter);
    for (int i = 0; i < 1; i++) {
        StringReader reader = new StringReader("龙虎胶囊 6 * 7cm");
        parse(new IndexAnalysis(reader), filters);
        parse(new ToAnalysis(reader), filters);
        parse(new DicAnalysis(reader), filters);
        parse(new NlpAnalysis(reader), filters);
        parse(new BaseAnalysis(reader), filters);
    }
}
Also used : StopRecognition(org.ansj.recognition.impl.StopRecognition) IndexAnalysis(org.ansj.splitWord.analysis.IndexAnalysis) BaseAnalysis(org.ansj.splitWord.analysis.BaseAnalysis) BufferedReader(java.io.BufferedReader) StringReader(java.io.StringReader) ArrayList(java.util.ArrayList) ToAnalysis(org.ansj.splitWord.analysis.ToAnalysis) DicAnalysis(org.ansj.splitWord.analysis.DicAnalysis) NlpAnalysis(org.ansj.splitWord.analysis.NlpAnalysis)

Example 10 with StopRecognition

use of org.ansj.recognition.impl.StopRecognition in project ansj_seg by NLPchina.

the class StopLibrary method insertStopNatures.

/**
	 * 词性过滤
	 * 
	 * @param key
	 * @param stopNatures
	 */
public static void insertStopNatures(String key, String... filterNatures) {
    StopRecognition fr = get(key);
    fr.insertStopNatures(filterNatures);
}
Also used : StopRecognition(org.ansj.recognition.impl.StopRecognition)

Aggregations

StopRecognition (org.ansj.recognition.impl.StopRecognition)10 ArrayList (java.util.ArrayList)4 BaseAnalysis (org.ansj.splitWord.analysis.BaseAnalysis)4 DicAnalysis (org.ansj.splitWord.analysis.DicAnalysis)4 IndexAnalysis (org.ansj.splitWord.analysis.IndexAnalysis)4 NlpAnalysis (org.ansj.splitWord.analysis.NlpAnalysis)4 ToAnalysis (org.ansj.splitWord.analysis.ToAnalysis)4 BufferedReader (java.io.BufferedReader)3 StringReader (java.io.StringReader)2 List (java.util.List)2 AnsjTokenizer (org.ansj.lucene.util.AnsjTokenizer)2 SynonymsRecgnition (org.ansj.recognition.impl.SynonymsRecgnition)2 Analysis (org.ansj.splitWord.Analysis)2 Forest (org.nlpcn.commons.lang.tire.domain.Forest)2 SmartForest (org.nlpcn.commons.lang.tire.domain.SmartForest)2