我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

如何在PHP中检测文档的语言?

The basics have already been answered here. But is there a pre-built PHP lib doing the same as Lingua::Identify from CPAN?

There's a PEAR package Text_LanguageDetect that I've used before. Get's the job done well enough. I'm not sure of any other libs that are more mature.

1- You could do it yourself (the hard way) - detecting both language and codepage by looking at character and n-gram frequencies. You would need lots of "training" data, but it's doable.

2- You could run a perl script to do the detection for you(much easier).

近期文章

  • Wordpress列出带有页面内容的嵌套页面
  • 正则表达式:查找所有旧的PHP开放标记
  • 请带有角色的PHP会话的说明
  • 在这种情况下尝试的最佳方法(Android应用程序)
  • 在aws S3上检查文件是图像还是xml
  • Laravel在对象存在时返回错误
  • 无法插入MySQL以获取选择值
  • 回声数组数据将所有文本转换为小写
  • 从PDO查询循环内部循环
  • 你能用jQuery Ajax只返回一个字符串吗?
  • 自定义字段选择框(添加选择关键字)
  • 删除两个特定字符之间的逗号
  • 如何在php中以编程方式单击按钮
  • 编写MySql查询以返回列表表单
  • 卸载通过load()加载的JS以避免重复?
  • 用于下一个请求的标头中的PHP Set-Cookie
  • Foreach回显出数组php中的元素名称[关闭]
  • 安装SAPRFC时make命令出错
  • MySQL根据变量从表中选择[重复]
  • 检查并在for循环中显示多个值

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华