[英]Identifying text using NLP
I'm trying to find the courses in the below line of text using some NLP technique. 我正在尝试使用一些NLP技术在下面的文本行中找到课程。
from nltk import word_tokenize, pos_tag, ne_chunk
sentence = "SDGI is offering courses like Electronics,Mechatronics, Physics,Mechanical Engineering"
print ne_chunk(pos_tag(word_tokenize(sentence)))
Out put of this is 出来这是
(S
(ORGANIZATION SDGI/NNP)
is/VBZ
offering/VBG
courses/NNS
like/IN
Electronics/NNS
,/,
Mechatronics/NNS
,/,
(PERSON Physics/NNPS)
,/,
(PERSON Mechanical/NNP Engineering/NNP))
Is there any way I can extract the courses from this line? 有什么方法可以从这一行中提取课程吗?
In my real project I will be getting so many documents from which I need to get the course names. 在我的真实项目中,我将获得如此多的文档,我需要从中获取课程名称。
Any help is appreciated! 任何帮助表示赞赏!
This might be too simplistic, but, if there is is a finite number of existing course names, it might be easier just to create a large look up table, tokenize your input and try to look each word up. 这可能过于简单了,但是,如果存在有限数量的现有课程名称,则创建大型查找表可能更容易,将输入标记化并尝试查找每个单词。 There will be some edge cases, but I'm not sure you need to take an ML/NLP approach to this problem. 会有一些边缘情况,但我不确定你需要采用ML / NLP方法解决这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.