【发布时间】:2020-10-14 11:49:56
【问题描述】:
我在输入中有一个文本(英文和法文):我想将文本分成每种语言的两个子文本:所以,我们将检测文本中的语言(> 2 种语言),然后剪切每个用他自己的语言写的文字:
输入:
You will then discover galleries in which 25-million bottles rest in the cellars, waiting for the
perfect moment to be tasted. From the bottle to the salmanazar, from the youngest wines to the oldest
vintages. - Vous trouverez alors des galeries parmi lesquelles 25 000 000 bouteilles reposent dans les
caves, attendant le parfait moment pour être dégustées.
期望的输出:
This text contains two languages : "fr" and "en"
text_in_english= "You will then discover galleries in which 25-million bottles rest in the cellars,
waiting for the perfect moment to be tasted. From the bottle to the salmanazar, from the youngest
wines to the oldest vintages."
text_in_frensh= "- Vous trouverez alors des galeries parmi lesquelles 25 000 000 bouteilles reposent
dans les caves, attendant le parfait moment pour être dégustées."
请问我们该怎么做?
【问题讨论】:
-
我认为您的问题与 spacy 无关。如果我是你,我会在谷歌上进行语言检测,然后将文本拆分成句子(如果你坚持的话,使用 spacy),然后检测每个句子的语言。
标签: python python-3.x nlp spacy