zoukankan      html  css  js  c++  java
  • Stanford3.8.0依存句法分析在java中运行



    linux 下的Stanford词性标注

    java -mx1g -cp "/home/hadoop/stanford-corenlp-full-2017-06-09/stanford-postagger.jar:" edu.stanford.nlp.tagger.maxent.MaxentTagger -model "/home/hadoop/stanford-corenlp-full-2017-06-09/models/chinese-distsim.tagger" -textFile source.txt > result-linux.txt


    win7下的Stanford 依存句法分析
    java -mx150m -cp "*;" edu.stanford.nlp.parser.lexparser.LexicalizedParser -outputFormat "penn,typedDependencies" lexparser/chinesePCFG.ser.gz source.txt > my.txt

    linux 下的Stanford 依存句法分析


    java -mx150m -cp "/home/hadoop/stanford-parser-full-2017-06-09/*:" edu.stanford.nlp.parser.lexparser.LexicalizedParser -outputFormat "penn,typedDependencies" lexparser/chinesePCFG.ser.gz   source.txt > my.txt

    (ROOT
      (IP
        (NP (NR 张传庆))
        (VP
          (ADVP (AD 曾))
          (PP (P 在)
            (LCP
              (NP
                (QP (CD 许多))
                (NP (NR 中国) (NN 引水) (NN 隧洞) (NN 项目)))
              (LC 中)))
          (VP (VV 发挥)
            (NP
              (ADJP (JJ 重要))
              (NP (NN 作用。)))))))

    nsubj(发挥-10, 张传庆-1)
    advmod(发挥-10, 曾-2)
    case(项目-8, 在-3)
    dep(项目-8, 许多-4)
    compound:nn(项目-8, 中国-5)
    compound:nn(项目-8, 引水-6)
    compound:nn(项目-8, 隧洞-7)
    nmod:prep(发挥-10, 项目-8)
    case(项目-8, 中-9)
    root(ROOT-0, 发挥-10)
    amod(作用。-12, 重要-11)
    dobj(发挥-10, 作用。-12)


    去掉penn
    java -mx150m -cp "/home/hadoop/stanford-parser-full-2017-06-09/*:" edu.stanford.nlp.parser.lexparser.LexicalizedParser -outputFormat "typedDependencies" lexparser/chinesePCFG.ser.gz   source.txt > my.txt
    只显示penn
    输出:
    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    SLF4J: Defaulting to no-operation (NOP) logger implementation
    SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
    Parsing file: source.txt
    Parsing [sent. 1 len. 12]: 张传庆 曾 在 许多 中国 引水 隧洞 项目 中 发挥 重要 作用。
    Parsed file: source.txt [1 sentences].
    Parsed 12 words in 1 sentences (7.22 wds/sec; 0.60 sents/sec).
    hadoop@master:~/stanford-parser-full-2017-06-09$ cat my.txt
    nsubj(发挥-10, 张传庆-1)
    advmod(发挥-10, 曾-2)
    case(项目-8, 在-3)
    dep(项目-8, 许多-4)
    compound:nn(项目-8, 中国-5)
    compound:nn(项目-8, 引水-6)
    compound:nn(项目-8, 隧洞-7)
    nmod:prep(发挥-10, 项目-8)
    case(项目-8, 中-9)
    root(ROOT-0, 发挥-10)
    amod(作用。-12, 重要-11)
    dobj(发挥-10, 作用。-12)

    java -mx150m -cp "/home/hadoop/stanford-parser-full-2017-06-09/*:" edu.stanford.nlp.parser.lexparser.LexicalizedParser -outputFormat "penn" lexparser/chinesePCFG.ser.gz   source.txt > my.txt

    输出
    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    SLF4J: Defaulting to no-operation (NOP) logger implementation
    SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
    Parsing file: source.txt
    Parsing [sent. 1 len. 12]: 张传庆 曾 在 许多 中国 引水 隧洞 项目 中 发挥 重要 作用。
    Parsed file: source.txt [1 sentences].
    Parsed 12 words in 1 sentences (20.76 wds/sec; 1.73 sents/sec).
    hadoop@master:~/stanford-parser-full-2017-06-09$ cat my.txt
    (ROOT
      (IP
        (NP (NR 张传庆))
        (VP
          (ADVP (AD 曾))
          (PP (P 在)
            (LCP
              (NP
                (QP (CD 许多))
                (NP (NR 中国) (NN 引水) (NN 隧洞) (NN 项目)))
              (LC 中)))
          (VP (VV 发挥)
            (NP
              (ADJP (JJ 重要))
              (NP (NN 作用。)))))))






  • 相关阅读:
    python调用c/c++库函数方法小结(c++和python的整合)
    一个机器学习的好网站
    Notepad++支持列选择模式
    awk的效率和python split 效率对比
    python 中的反射,装饰器,with语句
    hierarchy 在大数据上聚类的利弊
    shell 某个日期前的某一天(待补充)
    通过 cgi 运行 python 在lighttp上
    (译)Node.js的全局变量
    (译)Node.js的模块-exports和module.exports
  • 原文地址:https://www.cnblogs.com/herosoft/p/8135179.html
Copyright © 2011-2022 走看看