【发布时间】:2021-01-31 17:48:06
【问题描述】:
链接到regex101
我正在实现一个简单的 NLP 算法。我已经实施了 解决方案循环遍历原始字符串以协助正则表达式,但现在我 想看看我是否可以在纯正则表达式中做到这一点。
我不知道如何让“构建”组尊重负面的展望。我正在尝试捕获 [“自然语言处理”算法] 任何帮助将不胜感激,谢谢????
$subject_string = <<<'subject_string'
Projects I've built & Plan to build. HackMatch.io (May 2020 onward),
As of October 2020, I intend to start implementing "Natural Language Processing" algorithms
in PHP when I have time. I'll then use PHP to upload the results to big data tech (e.g. BigQuery)
to create some data visualizations.
subject_string;
$pattern = <<<'pattern'
/\b(?'verb'build|make|implementing)
(?'build'.+?(?!build|make|implementing))
(?=\bin\b|\bon\b)
(?:build|make|implementing)??/ix
pattern;
preg_match_all($pattern, $subject_string, $matches)
【问题讨论】:
标签: php regex algorithm artificial-intelligence pcre