Dongxing's Wiki Dongxing's Wiki
首页
  • 剑指 Offer
  • LeetCode
  • 算法与数据结构
  • Python 语言
  • Web 开发
  • Hive
  • Elastic Search
  • 机器学习
  • NLP
  • 检索技术
  • 数据分析
  • 经验笔记
  • Linux 配置
  • 博客进化记
  • 杂谈
GitHub (opens new window)
首页
  • 剑指 Offer
  • LeetCode
  • 算法与数据结构
  • Python 语言
  • Web 开发
  • Hive
  • Elastic Search
  • 机器学习
  • NLP
  • 检索技术
  • 数据分析
  • 经验笔记
  • Linux 配置
  • 博客进化记
  • 杂谈
GitHub (opens new window)
  • NLP基础

    • 七月NLP课程笔记(1) NLP基础技能
    • 七月NLP课程笔记(2)朴素贝叶斯
    • 七月NLP课程笔记(3)-LDA主题模型
    • 七月NLP课程笔记(4)-基于统计的翻译
    • 七月NLP课程笔记(5)-隐马尔科夫模型及其应用
    • 七月NLP课程笔记(6)-深度学习与NLP应用
    • 七月NLP课程笔记(7)-词向量与相关应用
    • 七月NLP课程笔记(8)-条件随机场
    • 中文分词相关技术
    • 使用gensim训练word2vec
    • 对话系统研究进展 - Paperweekly沙龙笔记
    • AI Challenger 2018 细粒度情感分析
  • NLP工具

    • 体验腾讯 AI lab 最近发布的中文 word2vec 预训练 embeddings
    • Stanford CoreNLP 快速上手
    • ParsCit 安装与使用
  • 知识图谱

    • 整理一些最近看的知识图谱资料
    • 知识图谱在金融业应用报告会笔记
    • DeepDive 中文 关系抽取实践
    • KBQA | Core Techniques of Question Answering Systems over Knowledge Bases: a Survey
  • NLP
  • NLP工具
anthony
2019-11-17

ParsCit 安装与使用

ParsCit 是一个论文文本解析工具包,把论文PDF转换成txt以后,通过 ParsCit 可以识别出论文文本中对各个参考文献的引用位置,也可以对文本划分出其属于论文中的哪个成分(标题、摘要、正文等等)。

ParsCit 网站:https://parscit.comp.nus.edu.sg/index.html

代码Github: https://github.com/knmnyn/ParsCit

目前已经有了基于神经网络的新版本 Neural-ParsCit( https://github.com/WING-NUS/Neural-ParsCit ),由于在使用中遇到点问题,暂且还是回归到旧版 ParsCit 来。

自带的安装说明比较简略,外加由于这里还用到了 Perl 完全没接触过,安装起来就比较困难。幸好找到一篇2019年的博文,而且专门针对 Ubuntu 16 上的安装做了详细说明,照着一路走下来还是比较顺利就安装成功了。

参考 https://ws-dl.blogspot.com/2019/07/2019-03-27-install-parscit-on-ubuntu.html

** 下载 ParsCit **

Download the source code from https://github.com/knmnyn/ParsCit and unzip it.

$ unzip ParsCit-master.zip
1

** 安装 c++ compiler ** 直接 g++ 试一下是否已有编译器,如果没有,则安装

$  sudo apt install g++
1

可以写一个简单的程序测试 g++ 是否好用(非必需步骤) To test it, write a simple program hello.cc and run

$ g++ -o hello hello.cc
$ ./hello
1
2

** 安装 ruby **

$ sudo apt install ruby-full
1

To test it, run

$ ruby --version
1

** 安装 Perl ** Perl一般随着Ubuntu自带了,to test it, run

$ perl --version
1

** 安装 Perl 模块 ** 首先运行【注意:我实测时中途会有一些报错说无操作权限创建man文件,建议下面这条命令用 sudo 来执行】

$ perl -MCPAN -e shell
1

按照提示一路默认值走下去,直到出现了如下的 CPAN 命令提示符:

cpan[1]>
1

然后按照下面输入命令,逐个安装相关的包:

cpan[1]> install Class::Struct
cpan[2]> install Getopt::Long
cpan[3]> install Getopt::Std
cpan[4]> install File::Basename
cpan[5]> install File::Spec
cpan[6]> install FindBin
cpan[7]> install HTML::Entities
cpan[8]> install IO::File
cpan[9]> install POSIX
cpan[10]> install XML::Parser
cpan[11]> install XML::Twig
(这一步会有一些需要确认的,按默认值走即可)
cpan[12]> install XML::Writer
cpan[13]> install XML::Writer::String
1
2
3
4
5
6
7
8
9
10
11
12
13
14

** 安装 CRF++ ** 在 ParsCit 的代码中内置了一份 CRF++ 0.51,首先进入到 crfpp 的文件夹里

$ cd crfpp/
1

解压 tar 文件

$ tar xvf crf++-0.51.tar.gz
1

进到 CRF++-0.51 目录中,下面命令均在此目录下

$ cd CRF++-0.51/
1

运行下面的命令

$ ./configure
$ make
1
2

会出现如下的错误提示

path.h:26:52: error: 'size_t' has not been declared
     void calcExpectation(double *expected, double, size_t) const;
                                                    ^
Makefile:375: recipe for target 'node.lo' failed
make[1]: *** [node.lo] Error 1
make[1]: Leaving directory '/home/jwu/github/ParsCit-master/crfpp/CRF++-0.51'
Makefile:240: recipe for target 'all' failed
make: *** [all] Error 2
1
2
3
4
5
6
7
8

修改一下 node.cpp 和 path.cpp 这两个文件,在文件的开头处添加两行include,添加之后效果如下:

#include "stdlib.h"   //新加这一行
#include <iostream>   //新加这一行
#include <cmath>   //以下原本就有
#include "path.h"
#include "common.h"
1
2
3
4
5

重新运行

$ ./configure
$ make
1
2

再运行

$ make clean
$ make
1
2

需要将编译生成的一些文件,复制到 parsCit 指定的位置,以便 parsCit 使用

// 在 CRF++-0.51 目录下运行
$ cp cp crf_learn crf_test ..
$ cd .libs  // 切换到 CRF++-0.51/.libs 下
$ cp -Rf * ../../.libs
1
2
3
4

** 大功告成 ** 测试下 ParsCit 能否使用,切换到 ParsCit 代码的根目录,再切换到 bin 目录

$ ./citeExtract.pl -m extract_all ../demodata/sample2.txt
$ ./citeExtract.pl -i xml -m extract_all ../demodata/E06-1050.xml
1
2

如果屏幕上有parse的输出结果,说明运行正常了。

上次更新: 2022/11/11, 2:11:00
Stanford CoreNLP 快速上手
整理一些最近看的知识图谱资料

← Stanford CoreNLP 快速上手 整理一些最近看的知识图谱资料→

Theme by Vdoing | Copyright © 2017-2023 anthony 京ICP备17072417-3
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式