SmoothNLP icon indicating copy to clipboard operation
SmoothNLP copied to clipboard

专注于可解释的NLP技术 An NLP Toolset With A Focus on Explainable Inference

Results 21 SmoothNLP issues
Sort by recently updated
recently updated
newest added

您好,我对 ngram_utils 的 get_ngram_freq_info 有些疑惑,请教一下: 为什么对于词频是否大于min_freq 的操作要在 _process_corpus_chunk 中进行? 假如每个 chunk 中各有一个 X,共10个 chunk ,那么即便 min_freq 设的是2 也不会统计到这个 X. min_freq 是只对当前 chunk 的词频结果判断嘛?不应该是整个corpus?

[ngram_utils.py](https://github.com/smoothnlp/SmoothNLP/blob/master/smoothnlp/algorithm/phrase/ngram_utils.py#L29) 和 [phrase_extraction.py](https://github.com/smoothnlp/SmoothNLP/blob/master/smoothnlp/algorithm/phrase/phrase_extraction.py#L55),注意到一开始的文本处理是 1. `re.split(r'[;;.。,,!\n!??]',corpus)`,先按此列表中的标点符号进行切分 2. `re.sub(u"([^\u4e00-\u9fa5\u0030-\u0039\u0041-\u005a\u0061-\u007a])", "", corpus)`,只保留汉字、数字、英文大小写(去掉了其它符号和无意义字符,但没有进行切分) 然后想问两个小问题: A. 为什么 [;;.。,,!\n!??] 符号部分要单独处理,就是说,为什么不选择在所有标点符号的部分都切开 ? B. 在第 2 步中,去掉无意义字符后,其前后位置部分会自然拼接, > 比如 "动物防疫法(修订版)_全文" 会变成 "动物防疫法修订版全文"。 * 无意义字符前后位置对应搭配增多,会导致信息熵偏大; * 会产生一些不合理的 n-gram 候选对("法修"、"订版全"、"版全"...)。...

我看使用方法里没有设置这两个阈值的参数 这两个参数是不可变的吗 corpus: 必需,file open()、database connection或list example:corpus = open(file_name, 'r', encoding='utf-8') corpus = conn.execute(query) corpus = list(***) top_k: float or int,表示短语抽取的比例或个数 chunk_size: int,用chunksize分块大小来读取文件 min_n: int,抽取ngram及以上 max_n: int,抽取ngram及以下 min_freq: int,抽取目标的最低词频 top_k是按照词频排序,还是按照左右邻字丰富程度或者内部凝聚程度排序

新词发现测试中的top100 top500是按什么排名的,同一个数据集为什么和我使用出来的结果不一样,以及和什么对比得出的精准度

```python from smoothnlp import kg kg.extract("SmoothNLP在V0.3版本中正式推出知识抽取功能") ``` 报出一堆错误 ``` Expecting value: line 1 column 1 (char 0) An invalid response was received from the upstream server Expecting value: line 1...

SmoothNLP-master/smoothnlp/algorithm/phrase/ngram_utils.py", line 75, in _process_corpus_chunk ngram_keys[ni] = (ngram_keys[ni] | nigram_freq.keys()) MemoryError 问题是ngram_keys过大?有什么优化方法吗