textpipe
1.0.0
该存储库不再维护
textpipe是一个Python软件包,用于将原始文本转换为清洁,可读的文本并从该文本中提取元数据。它的功能包括通过删除HTML标签并提取元数据(例如文本中的单词数量和命名实体)将原始文本转换为可读文本。
HTML和其他不可读的构造来清洁原始文本建议您使用虚拟环境安装Text -Pipe。
首先,使用Virtualenv或VirtualenvWrapper创建虚拟环境。
如果您的默认解释器为Python3.6,请使用VENV。
python3 -m venv .venvvirtualenv venv -p python3.6mkvirtualenv textpipe -p python3.6pip install textpipepip install -r requirements.txt虽然包装包装的sumplion.txt文件呼叫Spacy的en_core_web_sm型号,但可以根据您需要使用的模型和语言来更改此文件。有关更多信息,请参见其不同模型上的Spacy.io页面。
> >> from textpipe import doc , pipeline
> >> sample_text = 'Sample text! <!DOCTYPE>'
> >> document = doc . Doc ( sample_text )
> >> print ( document . clean )
'Sample text!'
> >> print ( document . language )
'en'
> >> print ( document . nwords )
2
> >> pipe = pipeline . Pipeline ([ 'CleanText' , 'NWords' ])
> >> print ( pipe ( sample_text ))
{ 'CleanText' : 'Sample text!' , 'NWords' : 3 }为了将现有的Text -Pipe操作扩展到您自己的专有操作;
test_pipe = pipeline . Pipeline ([ 'CleanText' , 'NWords' ])
def custom_op ( doc , context = None , settings = None , ** kwargs ):
return 1
custom_argument = { 'argument' : 1 }
test_pipe . register_operation ( 'CUSTOM_STEP' , custom_op )
test_pipe . steps . append (( 'CUSTOM_STEP' , custom_argument ))有关贡献者的指南,请参见贡献。
0.12.1
0.12.0
0.11.9
ents属性0.11.8
cats属性0.11.7
0.11.6
0.11.5
0.11.4
0.11.1
0.11.0
0.9.0
0.8.6
0.8.5
0.8.4
0.8.3
0.8.2
0.8.1
0.8.0
0.7.2
0.7.0
context遍布夸尔格(Kwarg)register_operation加载自定义操作