• 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 作用。)))))))






  • 相关阅读:
    Random简介
    十道海量数据处理面试题
    Django models 的字段类型
    执行monkey APK 制作
    MTK平台-抓取蓝牙log
    超级硬件代理解决企业Web提速上网问题
    Red Hat Linux 安装 (本地、网络安装)
    由安装两块网卡的linux系统中引起网络不通想到的
    Linux企业应用--RHAS 2.1 下安装中文 Lotus Domino R 6.5 图解
    巧用Linux 架设TFTP Server备份路由器的配置文件
  • 原文地址:https://www.cnblogs.com/herosoft/p/8135179.html
Copyright © 2020-2023  润新知