首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么"machine_learning“既是"machine_learning”又是"machine_learne"?

为什么"machine_learning“既是"machine_learning”又是"machine_learne"?
EN

Stack Overflow用户
提问于 2019-09-13 14:08:25
回答 1查看 85关注 0票数 0

我正在运行LDA的一些文本。当我对产生的主题进行可视化处理时,我发现双标"machine_learning“既被命名为"machine_learning”,也被称为"machine_learne“。这里是我所能提供的最起码的一个可重复的例子:

代码语言:javascript
复制
import en_core_web_sm

tokenized = [
    [
        'artificially_intelligent', 'funds', 'generating', 'excess', 'returns',
        'artificial_intelligence', 'deep_learning', 'compelling', 'reasons',
        'join_us', 'artificially_intelligent', 'fund', 'develop', 'ai',
        'machine_learning', 'capabilities', 'real', 'cases', 'big', 'players',
        'industry', 'discover', 'emerging', 'trends', 'latest_developments',
        'ai', 'machine_learning', 'industry', 'players', 'trading',
        'investing', 'live', 'investment', 'models', 'learn', 'develop',
        'compelling', 'business', 'case', 'clients', 'ceos', 'adopt', 'ai',
        'machine_learning', 'investment', 'approaches', 'rare', 'gathering',
        'talents', 'including', 'quants', 'data_scientists', 'researchers',
        'ai', 'machine_learning', 'experts', 'investment_officers', 'explore',
        'solutions', 'challenges', 'potential', 'risks', 'pitfalls',
        'adopting', 'ai', 'machine_learning'
    ],
    [
        'recent_years', 'topics', 'data_science', 'artificial_intelligence',
        'machine_learning', 'big_data', 'become_increasingly', 'popular',
        'growth', 'fueled', 'collection', 'availability', 'data',
        'continually', 'increasing', 'processing', 'power', 'storage', 'open',
        'source', 'movement', 'making', 'tools', 'widely', 'available',
        'result', 'already', 'witnessed', 'profound', 'changes', 'work',
        'rest', 'play', 'trend', 'increase', 'world', 'finance', 'impacted',
        'investment', 'managers', 'particular', 'join_us', 'explore',
        'data_science', 'means', 'finance_professionals'
    ]
]

nlp = en_core_web_sm.load(disable=['parser', 'ner'])

def lemmatization(descrips, allowed_postags=None):
    if allowed_postags is None:
        allowed_postags = ['NOUN', 'ADJ', 'VERB',
                           'ADV']
    lemmatized_descrips = []
    for descrip in descrips:
        doc = nlp(" ".join(descrip))
        lemmatized_descrips.append([
            token.lemma_ for token in doc if token.pos_ in allowed_postags
        ])
    return lemmatized_descrips

lemmatized = lemmatization(tokenized)

print(lemmatized)

您将注意到,"machine_learne“在输入tokenized中找不到,但是"machine_learning”和"machine_learne“都在输出lemmatized中找到。

造成这种情况的原因是什么,我是否可以预期它会引起与其他重大事件/三联事件有关的问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-09-13 17:22:21

我想你误解了词性标注和词条化的过程。

POS标记是基于其他几个信息,而不仅仅是单词(我不知道哪个是您的母语,但这在许多语言中是常见的),但也基于周围的单词(例如,在许多语句中,一个常见的学习规则是,在许多语句中,动词之前通常有一个名词,它代表动词的代理)。

当你把所有这些‘记号’传递给你的狐猴时,斯皮西的狐猴会试图“猜出”这是你的独白的一部分。

在许多情况下,它将用于默认名词,如果它不在查找表中的常见名词和不规则名词,它将尝试使用泛型规则(例如剥去复数's')。

在其他情况下,它将使用基于某些模式的默认动词(最后是"-ing“),这可能就是您的情况。因为在任何字典中都不存在动词"machine_learning“(它的模型中没有实例),所以它将选择”there“路径并应用泛型规则。

因此,machine_learning很可能是由一个通用的‘ing’到e‘规则(例如在-> make,烘焙-> bake的情况下)来命名的,这是许多常规动词所共有的。

请看下面的测试示例:

代码语言:javascript
复制
for descrip in tokenized:
        doc = nlp(" ".join(descrip))
        print([
            (token.pos_, token.text) for token in doc
        ])

输出:

(“名词”,“artificially_intelligent”),(“名词”,“基金”),(“动词”,“生成”),(“ADJ”,“过度”),(“名词”,“返回”),(“名词”,“artificial_intelligence”),(名词,'deep_learning'),('ADJ',‘令人信服’),(‘名词’,‘理由’),('PROPN','join_us'),(‘名词’,'artificially_intelligent'),(‘名词’,‘基金’),(‘名词’,‘发展’),(‘动词’,'ai'),(‘动词’,'machine_learning'),(‘名词’,‘能力’),('ADJ',‘真实’),(‘名词’,‘案例’),('ADJ',‘大’),(‘名词’,‘玩家’),(名词,工业),(‘动词’,‘发现’),(‘动词’,‘新兴’),(‘名词’,‘趋势’),(名词‘,'latest_developments'),(’动词‘,'ai'),(’动词‘,'machine_learning'),(’名词‘,’工业‘),(’名词‘,’玩家‘),(’名词‘,’交易‘),(‘动词’,‘投资’),('ADJ','live'),(‘名词’,‘投资’),(‘名词’,‘模型’),(‘动词’,‘学习’),(‘动词’,‘发展’),('ADJ',‘强制’),(‘名词’,‘商业’),(‘名词’,‘案例’),(‘名词’,‘客户’),(‘名词’,‘客户’,‘’ceos‘,(’动词‘,’采取‘),(’动词‘,'ai'),('ADJ','machine_learning'),(’名词‘,’投资‘),(’名词‘,’方法‘),('ADJ',’稀有‘),(’动词‘,’聚集‘),(’名词‘,’人才‘),(’动词‘,包括’名词‘,'quants'),(名词,'data_scientists'),(‘名词’,‘研究人员’),(‘动词’,'ai'),('ADJ','machine_learning'),(‘名词’,‘专家’),(‘名词’,'investment_officers'),(‘动词’,‘探索’),(‘名词’,‘解决方案’),(‘动词’,‘挑战’),('ADJ',‘潜力’),(“名词”,“风险”),(“名词”,“陷阱”),(“动词”,“采纳”),(“动词”,“爱”),(名词,'machine_learning')

基于上下文,machine_learning既是动词,也是名词。但是要知道,仅仅将这些单词连在一起就会使你感到混乱,因为它们在自然语言中并没有像预期的那样有序。

甚至连一个人都无法理解和正确地将以下文字标记为POS:

artificially_intelligent基金创造超额回报artificial_intelligence deep_learning令人信服的原因join_us artificially_intelligent基金开发ai machine_learning能力真实案例大公司发现新兴趋势行业参与者交易投资现场投资模式学习开发有吸引力的商业案例客户首席执行官采用ai machine_learning投资方式包括quants data_scientists研究人员ai machine_learning experts investment_officers探索解决方案挑战潜在风险陷阱采用ai machine_learning

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57925219

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档