Package org.fnlp.nlp.cn.tag

Examples of org.fnlp.nlp.cn.tag.CWSTagger.tag()


   */
  public static void main(String[] args) throws Exception {
    CWSTagger tag = new CWSTagger("../models/seg.m");
    System.out.println("不使用词典的分词:");
    String str = " 媒体计算研究所成立了, 高级数据挖掘(data mining)很难。 乐phone热卖!";
    String s = tag.tag(str);
    System.out.println(s);
   
    //设置英文预处理
    tag.setEnFilter(true);
    s = tag.tag(str);
View Full Code Here


    String s = tag.tag(str);
    System.out.println(s);
   
    //设置英文预处理
    tag.setEnFilter(true);
    s = tag.tag(str);
    System.out.println(s);
//    tag.setEnFilter(false);
   
    System.out.println("\n设置临时词典:");
    ArrayList<String> al = new ArrayList<String>();
View Full Code Here

    al.add("媒体计算研究所");
    al.add("乐phone");
    Dictionary dict = new Dictionary(false);
    dict.addSegDict(al);
    tag.setDictionary(dict);
    s = tag.tag(str);
    System.out.println(s);
   
   
    CWSTagger tag2 = new CWSTagger("../models/seg.m", new Dictionary("../models/dict.txt"));
    System.out.println("\n使用词典的分词:");
View Full Code Here

   
   
    CWSTagger tag2 = new CWSTagger("../models/seg.m", new Dictionary("../models/dict.txt"));
    System.out.println("\n使用词典的分词:");
    String str2 = "媒体计算研究所成立了, 高级数据挖掘很难。 乐phone热卖!";
    String s2 = tag2.tag(str2);
    System.out.println(s2);
   
    //使用不严格的词典
    CWSTagger tag3 = new CWSTagger("../models/seg.m", new Dictionary("../models/dict_ambiguity.txt",true));
    //尽量满足词典,比如词典中有“成立”“成立了”和“了”, 会使用Viterbi决定更合理的输出
View Full Code Here

    //使用不严格的词典
    CWSTagger tag3 = new CWSTagger("../models/seg.m", new Dictionary("../models/dict_ambiguity.txt",true));
    //尽量满足词典,比如词典中有“成立”“成立了”和“了”, 会使用Viterbi决定更合理的输出
    System.out.println("\n使用不严格的词典的分词:");
    String str3 = "媒体计算研究所成立了, 高级数据挖掘很难";
    String s3 = tag3.tag(str3);
    System.out.println(s3);
    str3 = "我送给力学系的同学一个玩具 (送给给力力学力学系都在词典中)";
    s3 = tag3.tag(str3);
    System.out.println(s3);
   
View Full Code Here

    System.out.println("\n使用不严格的词典的分词:");
    String str3 = "媒体计算研究所成立了, 高级数据挖掘很难";
    String s3 = tag3.tag(str3);
    System.out.println(s3);
    str3 = "我送给力学系的同学一个玩具 (送给给力力学力学系都在词典中)";
    s3 = tag3.tag(str3);
    System.out.println(s3);
   
    System.out.println("\n处理文件:");
    String s4 = tag.tagFile("../example-data/data-tag.txt");
    System.out.println(s4);
View Full Code Here

    Dictionary dict=new Dictionary();
    dict.addFile("./models/dict.txt");
    tag.setDictionary(dict);
    ArrayList<String> str = MyCollection.loadList("./testcase/test case seg.txt",null);
    for(String s:str){     
      String t = tag.tag(s);
//      t = tag.tag(t);
      System.out.println(t);
    }
    tag.setEnFilter(false);
    for(String s:str){
View Full Code Here

//      t = tag.tag(t);
      System.out.println(t);
    }
    tag.setEnFilter(false);
    for(String s:str){
      String t = tag.tag(s);
      System.out.println(t);
    }
   
    String t = tag.tagFile("data/FNLPDATA/seg/bad case.txt");
    System.out.println(t);
View Full Code Here

   */
  public static void main(String[] args) throws Exception {
    CWSTagger tag = new CWSTagger("./models/seg.m");
    ArrayList<String> str = MyCollection.loadList("./testcase/seg.txt",null);
    for(String s:str){     
      String t = tag.tag(s);
//      t = tag.tag(t);
      System.out.println(t);
    }
    tag.setEnFilter(false);
    for(String s:str){
View Full Code Here

//      t = tag.tag(t);
      System.out.println(t);
    }
    tag.setEnFilter(false);
    for(String s:str){
      String t = tag.tag(s);
      System.out.println(t);
    }
   
    ArrayList<String> str1 = MyCollection.loadList("data/FNLPDATA/seg/bad case.txt",null);
    for(String s:str1){   
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.