Linux 中使用 fastText 预测语言的命令

commands to predict the language with fastText in Linux

对于语言识别,我使用以下教程:

Fasttext language detection tutorial

执行教程中的命令后: ./fasttext 测试 langdetect.bin valid.txt

我有以下输出: N 10000 P@1 0.967 R@1 0.967

在此之后,哪些命令将预测语言?如何输入其他语言的文字?

我对这种语言检测很陌生。我可以找到大量关于 python 预测的教程,但在 linux 命令行中找不到。

提前致谢。

语言检测是使用监督模型 (here you can find the tutorial) 进行文本分类的一种特殊情况。

根据教程,您可以通过键入以下内容来预测新示例:

./fasttext predict-prob langdetect.bin - -1 0.5

(我们想要尽可能多的预测(参数-1)并且我们只想要概率高于或等于0.5的标签)

然后输入句子。

如果你有一个txt文件,里面有待分类的句子,你可以输入:

$ ./fasttext predict-prob langdetect.bin test.txt k

其中 k 是要显示的 类 的数量。

这个cheatsheet也可能有用。