首页 > 解决方案 > 使用 Python 计算给定句子中的 T 单元数

问题描述

我一直在从事第二语言开发项目。我需要使用 Python 计算给定句子的t 单位。例如,对于以下句子:

The man did not like water.

1 t-单位(这个人不喜欢水)

The man did not like water although he lived by the sea.

1 t-unit(这个人虽然住在海边,但不喜欢水)

The man never liked water and he certainly did not like living in the swamp with her grandparents.

1 t-unit(这个男人从不喜欢水) 1 t-unit(他当然不喜欢和她的祖父母一起住在沼泽里)

The man did not like water or juice.

1 吨单位(该男子不喜欢水或果汁)

我检查了 nltk、spacy 和 stanford nlp (stanza),但发现它们根本不包括这样的 t-unit 检测。

我遇到过这个,但它是关于子句提取的。

知道如何使用 Python 检测这样的 t 单元吗?

标签: pythonnlpnltkstanford-nlpspacy

解决方案


推荐阅读