【发布时间】:2018-02-08 12:59:06
【问题描述】:
我是 PHP 的初学者 NLP 程序员。 我只是想讨论一下停用词的删除。
这是我的做法:
我有以下变量声明$words = "he's the young man";
然后我删除像这样的常用词
$common_words = $this->common_words();
$ncwords = preg_replace('/\b('.implode('|',$common_words).')\b/','',$data);
// I have save the array common_words in another function
我把我不常用的词都炸了
$a_ncwords=explode(" ", $ncwords);
但是,当我打印$a_ncwords 时,就像这样print_r($a_ncwords);
我得到这样的结果:
Array ( [0] => [1] => [2] => young [3] => man )
为什么index[0] 和index[1] 数组值为空?
【问题讨论】:
标签: php regex codeigniter nlp text-processing