我试图使用javascript的拆分来获取字符串中的句子,但保留分隔符,例如!?.
到目前为止我有
sentences = text.split(/[\\.!?]/);
Run Code Online (Sandbox Code Playgroud)
哪个有效,但不包括每个句子的结尾标点符号(.!?).
有谁知道这样做的方法?
我有许多PDF文档,我已将其读入带库的语料库中tm.如何将语料库分解成句子?
可以readLines通过sentSplit从包qdap[*] 读取文件来完成.该功能需要数据帧.它还需要放弃语料库并单独阅读所有文件.
如何在语料库中传递函数sentSplit{ qdap} tm?或者,还有更好的方法?.
注意:sentDetect 库中有一个函数,openNLP现在是Maxent_Sent_Token_Annotator- 同样的问题适用:如何将它与语料库[tm]结合起来?
我已经看到了一些类似的问题,但我正在努力实现这一目标.
给定一个字符串,str ="月亮是我们的天然卫星,即它围绕地球旋转!" 我想提取单词并将它们存储在一个数组中.预期的数组元素就是这样.
the
moon
is
our
natural
satellite
i.e.
it
rotates
around
the
earth
Run Code Online (Sandbox Code Playgroud)
我尝试使用String.split(','\ t','\ r'),但这不能正常工作.我也尝试删除.和其他标点符号,但我想要一个像"ie"这样的字符串也要解析出来.实现这一目标的最佳方法是什么?我也尝试使用regex.split无济于事.
string[] words = Regex.Split(line, @"\W+");
Run Code Online (Sandbox Code Playgroud)
肯定会欣赏正确方向的一些推动.
我希望有人可以指出我正确的方向来学习从一堆文本中分离出行动.
假设我有这个文本
Drop off the dry cleaning, and go to the corner store and pick-up a jug of milk and get a pint of strawberries. Then, go pick up the kids from school. First, get John who is in the daycare next to the library, and then get Sam who is two blocks away. By the time you've got the kids, you'll need to stop by the doctors office for the perscription. Tim's flight arrives at 4pm. It's American Airlines …
nlp machine-learning information-extraction pos-tagger sentence
我是 Spacy 和 NLP 的新手。我在使用 Spacy 进行句子分割时面临以下问题。
我试图标记为句子的文本包含编号列表(编号和实际文本之间有空格),如下所示。
import spacy
nlp = spacy.load('en_core_web_sm')
text = "This is first sentence.\nNext is numbered list.\n1. Hello World!\n2. Hello World2!\n3. Hello World!"
text_sentences = nlp(text)
for sentence in text_sentences.sents:
print(sentence.text)
Run Code Online (Sandbox Code Playgroud)
输出(1.,2.,3. 被视为单独的行)是:
This is first sentence.
Next is numbered list.
1.
Hello World!
2.
Hello World2!
3.
Hello World!
Run Code Online (Sandbox Code Playgroud)
但是如果编号和实际文本之间没有空格,那么句子标记化就可以了。像下面这样:
import spacy
nlp = spacy.load('en_core_web_sm')
text = "This is first sentence.\nNext is numbered list.\n1.Hello World!\n2.Hello World2!\n3.Hello World!"
text_sentences = nlp(text)
for sentence in text_sentences.sents: …Run Code Online (Sandbox Code Playgroud) 我有一个团队名称列表。让我们说他们是
teamnames=["Blackpool","Blackburn","Arsenal"]
Run Code Online (Sandbox Code Playgroud)
在程序中,我问用户他想和哪个团队一起做事。如果用户的输入与团队匹配并打印,我希望 python 自动完成用户的输入。
因此,如果用户输入“Bla”并按下enter,则 Blackburn 团队应自动打印在该空间中并在其余代码中使用。例如;
您的选择:Bla(用户输入“Bla”并按下enter)
它应该是什么样子
您的选择:布莱克本(该程序完成了单词的其余部分)
这是一个NLP问题,我想知道如何继续.
问题有多难?我可以用同义词替换这个单词并检查语法是否正确?
我正在尝试开发一个自然语言接口到数据库,我只是想知道是否有一个库或API(Java),我可以用来将问题(疑问句)转换为命令(命令句).
例如:"1970年以前哪些员工出生?" "让员工在1970年之前出生".
你好,我是新的正则表达式,我开始使用python.我坚持从英语句子中提取所有单词.到目前为止,我有:
import re
shop="hello seattle what have you got"
regex = r'(\w*) '
list1=re.findall(regex,shop)
print list1
Run Code Online (Sandbox Code Playgroud)
这给出了输出:
['你好','西雅图','什么','有','你']
如果我替换正则表达式
regex = r'(\w*)\W*'
Run Code Online (Sandbox Code Playgroud)
然后输出:
['你好','西雅图','什么','有','你','有','']
而我想要这个输出
['你好','西雅图','什么','有','你','有']
请指出我哪里出错了.
如果设置了环境变量,我想设置属性.我搜索了很多内容,我发现的所有内容都类似于下面的代码,但我不断收到错误:
[致命]不可解析的POM Y:\ Maven\parent-pom\pom.xml:TEXT必须紧跟END_TAG而不是START_TAG(位置:START_TAG s een ... roperties"\ r \n
classpathref ="maven. plugin.classpath"/> ... @ 29:55)@第29行,第55栏
这是我正在尝试的代码,它在pom.xml中,我运行命令 -
mvn --errors deploy
当然,如果您有关于如何根据环境变量内容在pom.xml中设置属性的其他建议,我将很乐意获得任何其他解决方案.
谢谢,Eli
<distributionManagement>
.....
</distributionManagement>
<properties>
<tasks>
<taskdef resource="net/sf/antcontrib/antcontrib.properties"
classpathref="maven.plugin.classpath" />
<if>
<condition>
<equals arg1="${env.WAS60_HOME}" arg2=""\>
</condition>
<then>
<was60.home>${env.WAS60_HOME}</was60.home>
<javac>${was60.home}/java/bin/javac</javac>
</then>
</if>
<if>
<condition>
<equals arg1="${env.WAS85_HOME}" arg2=""\>
</condition>
<then>
<was85.home>${env.WAS85_HOME}</was60.home>
<javac>${was85.home}/java/bin/javac</javac>
</then>
</if>
</tasks>
</properties>
<profiles>
<profile>
<id>was.base.v60</id>
<dependencies>
<dependency>
....
<systemPath>${was60.home}/java/jre/lib/xml.jar</systemPath>
</dependency>
.....
</dependencies>
</profile>
<profile>
<id>was.base.v85</id>
<dependencies>
<dependency>
....
<systemPath>${was85.home}/java/jre/lib/xml.jar</systemPath>
</dependency>
.....
</dependencies>
</profile>
</profiles>
Run Code Online (Sandbox Code Playgroud) sentence ×10
nlp ×4
regex ×3
python ×2
split ×2
words ×2
autocomplete ×1
c# ×1
grammar ×1
if-statement ×1
javascript ×1
maven ×1
pom.xml ×1
pos-tagger ×1
printing ×1
qdap ×1
r ×1
similarity ×1
spacy ×1
string ×1
tm ×1
tokenize ×1
xml ×1