首页 文章 精选 留言 我的

精选列表

搜索[文本编辑器],共10000篇文章
优秀的个人博客,低调大师

java中利用hanlp比较两个文本相似度的步骤

使用 HanLP - 汉语言处理包 来处理,他能处理很多事情,如分词、调用分词器、命名实体识别、人名识别、地名识别、词性识别、篇章理解、关键词提取、简繁拼音转换、拼音转换、根据输入智能推荐、自定义分词器 使用很简单,只要引入hanlp.jar包,便可处理(新版本的hanlp安装包可以去github下载安装),下面是某位大神的操作截图:

优秀的个人博客,低调大师

sklearn.feature_extraction.text.CountVectorizer提取文本特征,将文档词块化

sklearn.feature_extraction.text. CountVectorizer ( input=u'content' , encoding=u'utf-8' , decode_error=u'strict' , strip_accents=None , lowercase=True , preprocessor=None , tokenizer=None , stop_words=None , token_pattern=u'(? u)\b\w\w+\b' , ngram_range=(1 , 1) , analyzer=u'word' , max_df=1.0 , min_df=1 , max_features=None , vocabulary=None , binary=False , dtype=<type 'numpy.int64'> ) 作用:Convert a collection of text documents to a matrix of token counts(计算词汇的数量,即tf);结果由scipy.sparse.coo_matrix进行稀疏表示。 看下参数就知道CountVectorizer在提取tf时都做了什么: strip_accents : {‘ascii’, ‘unicode’, None}:是否除去“音调”,不知道什么是“音调”?看:http://textmechanic.com/?reqp=1&reqr=nzcdYz9hqaSbYaOvrt== lowercase : boolean, True by default:计算tf前,先将所有字符转化为小写。 这个参数一般为True。 preprocessor : callable or None (default):复写thepreprocessing (string transformation) stage,但保留tokenizing and n-grams generation steps. 这个参数可以自己写。 tokenizer : callable or None (default):复写the string tokenization step,但保留preprocessingand n-grams generation steps. 这个参数可以自己写。 stop_words : string {‘english’}, list, or None (default):如果是‘english’, a built-in stop word list for English is used。如果是a list,那么最终的tokens中将去掉list中的所有的stop word。如果是None, 不处理停顿词;但 参数 max_df 可以设置为 [0.7, 1.0) 之间,进而根据 intra corpus document frequency(df) of terms自动detect and filter stop words。这个参数要根据自己的需求调整。 token_pattern : string:正则表达式,默认筛选长度大于等于2的字母和数字混合字符(select tokens of 2 or more alphanumeric characters),参数analyzer设置为word时才有效。 ngram_range : tuple (min_n, max_n):n-values值得上下界,默认是 ngram_range=(1 , 1), 该范围之内的n元feature都会被提取出来! 这个参数要根据自己的需求调整。 analyzer : string, {‘word’, ‘char’, ‘char_wb’} or callable:特征基于wordn-grams还是character n-grams。如果是callable是自己复写的从the raw, unprocessed input提取特征的函数。 max_df : float in range [0.0, 1.0] or int, default=1.0: min_df : float in range [0.0, 1.0] or int, default=1:按比例,或绝对数量删除df超过max_df或者df小于min_df的word tokens。有效的前提是参数vocabulary设置成Node。 max_features : int or None, default=None:选择tf最大的max_features个特征。有效的前提是参数vocabulary设置成Node。 vocabulary : Mapping or iterable, optional:自定义的特征word tokens,如果不是None,则只计算vocabulary中的词的tf。 还是设为None靠谱。 binary : boolean, default=False:如果是True,tf的值只有0和1,表示出现和不出现,useful for discrete probabilistic models that model binary events rather than integer counts.。 dtype : type, optional:Type of the matrix returned by fit_transform() or transform().。

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册