Solution for automatic update of Chinese word segmentation full-text index in NEO4J
<p></p>
Solution for automatic update of Chinese word segmentation full-text index in NEO4J
- 1. Sample data
- 2. Differences between English and Chinese Full-Text Indexes
- 3. APOC has its own English full-text indexing process (indexing can be updated automatically)
- 4. Custom Chinese word segmentation full-text index plug-in (unsuccessful automatic index update)
- V. Label Cross-search
- 6. Custom Chinese Word Segmentation Plugin (Failed to Update Indexes Independently of Nodes)
- 1. Add Full-Text Index
- 2. Add Nodes and Attributes and Update Full-Text Index
- 3. Add 2 new nodes or updated attributes to the index
- 4. Retrieval
- 7. Resolve Transaction Submission Timeout
Failed to implement automatic updates using the NEO4J INDEX API, converting a way of thinking to solve this problem (synchronizing updates to the corresponding full-text index when updating a node or creating a new one.)
1. Sample data
2. Differences between English and Chinese Full-Text Indexes
1. Create NEO4J default index
CALL apoc.index.addAllNodes('Loc', {Loc:["description","cause","year"]})
// The following retrieval was unsuccessful:
CALL apoc.index.search('Loc', 'Loc.description:Chinese~') YIELD node RETURN node
CALL apoc.index.search('Loc', 'Loc.description:Chinese*') YIELD node RETURN node
CALL apoc.index.search('Loc', 'Loc.description:test~') YIELD node RETURN node
CALL apoc.index.search('Loc', 'Loc.description:Test Chinese~') YIELD node RETURN node
2. Delete Index
CALL apoc.index.remove('Loc')
3. Create an index that supports Chinese words
CALL zdr.index.addChineseFulltextIndex('Loc', ["description","cause","year"], 'Loc') YIELD message RETURN message
// The following retrieval was successful:
CALL apoc.index.search('Loc', 'description:Chinese~') YIELD node RETURN node
CALL apoc.index.search('Loc', 'description:Chinese*') YIELD node RETURN node
CALL apoc.index.search('Loc', 'description:test~') YIELD node RETURN node
CALL apoc.index.search('Loc', 'description:Test Chinese~') YIELD node RETURN node
3. APOC has its own English full-text indexing process (indexing can be updated automatically)
1. Add Full-Text Index
CALL apoc.index.addAllNodes('Loc', {Loc:["description","cause","year"]},{autoUpdate:true})
2. New Nodes and Attributes
CREATE (n:Loc {name:'V'}) SET n.description='Testing Chinese word segmentation, the final chapter of the duplicate show was very exciting. It is said that knowledge mapping and artificial intelligence technology were applied to that movie!',n.cause='Test the English word breaker, Mobile World Congress, the world's largest gathering for the mobile industry, ' RETURN n
3. Retrieval
Indexes can be updated automatically, but they are not friendly to Chinese retrieval, such as the following tests:
// Retrieval failed:
CALL apoc.index.search('Loc', 'Loc.cause:Test English word breakers~') YIELD node RETURN node
CALL apoc.index.search('Loc', 'Loc.description:Test Chinese word segmentation~') YIELD node RETURN node
// Retrieved successfully:
CALL apoc.index.search('Loc', 'Loc.cause:Test English word breakers*') YIELD node RETURN node
CALL apoc.index.search('Loc', 'Loc.description:Test Chinese word segmentation*') YIELD node RETURN node
4. Custom Chinese word segmentation full-text index plug-in (unsuccessful automatic index update)
The addChineseFulltextAutoIndex process succeeds in creating a full-text index to add a full-text indexing process that supports Chinese, but automatic updates are not supported for updating new attributes of nodes.
1. Add Full-Text Index
CALL zdr.index.addChineseFulltextAutoIndex('IKAnalyzer',["description","cause","year"],'Loc',{autoUpdate:'true'}) YIELD message RETURN message
2. New Nodes and Attributes
CREATE (n:Loc {name:'V'}) SET n.description='Testing Chinese word segmentation, the final chapter of the duplicate show was very exciting. It is said that knowledge mapping and artificial intelligence technology were applied to that movie!',n.cause='Test the English word breaker, Mobile World Congress, the world's largest gathering for the mobile industry, ' RETURN n
3. Retrieval
After adding a full-text search, you can retrieve:
CALL zdr.index.chineseFulltextIndexSearch('IKAnalyzer', 'description:Acridyl Aminomethane Sulfonymethoxyaniline', 100) YIELD node RETURN node
Re-index before retrieving:
CALL zdr.index.chineseFulltextIndexSearch('IKAnalyzer', 'description:test~', 100) YIELD node RETURN node
V. Label Cross-search
Add ChineseFulltextAutoIndex/addChineseFulltextIndex supports multiple tags while retrieving, using the same index name when building the index.
Tag: Loc
CALL zdr.index.addChineseFulltextAutoIndex('Loc',["description","cause","name"],'Loc',{autoUpdate:'true'}) YIELD message RETURN message
Tag: LocProvince'
CALL zdr.index.addChineseFulltextAutoIndex('Loc',["description","cause","name"],'LocProvince',{autoUpdate:'true'}) YIELD message RETURN message
Retrieve node:
CALL apoc.index.search('Loc', 'name:p~') YIELD node RETURN node

6. Custom Chinese Word Segmentation Plugin (Failed to Update Indexes Independently of Nodes)
To support single-node index updates, develop the following process.(The automatic update scheme described in the third section fails, and updates to the corresponding full-text index synchronously when updating or creating a new node.)
1. Add Full-Text Index
CALL apoc.index.remove('Loc')
CALL zdr.index.addChineseFulltextIndex('Loc',["description","cause","year"],'Loc') YIELD message RETURN message
2. Add Nodes and Attributes and Update Full-Text Index
CREATE (n:Loc {name:'V'}) SET n.description='Testing Chinese word segmentation, the final chapter of the duplicate show was very exciting. It is said that knowledge mapping and artificial intelligence technology were applied to that movie!',n.cause='Test the English word breaker, Mobile World Congress, the world's largest gathering for the mobile industry, ' RETURN n
3. Add 2 new nodes or updated attributes to the index
MATCH (n) WHERE n.name='V' WITH n CALL zdr.index.addNodeChineseFulltextIndex(n, ['description']) RETURN *
4. Retrieval
CALL zdr.index.chineseFulltextIndexSearch('Loc', 'description:Test Chinese~') YIELD node RETURN node

7. Resolve Transaction Submission Timeout
If the transaction commit timeout setting is configured, Cancel when building the index.
#********************************************************************
### Neo4j transcation timeout
###******************************************************************
#dbms.transaction.timeout=180s
Use a background script to execute the indexer:
# index.sh
#!/usr/bin/env bash
nohup /neo4j-community-3.4.9/bin/neo4j-shell -file build.cql >>indexGraph.log 2>&1 &
// build.cql
CALL zdr.index.addChineseFulltextIndex('IKAnalyzer', ['description','fullname','name','lnkurl'], 'LinkedinID') YIELD message RETURN message;
All of the above references to the NEO4J custom process
原文地址:https://programmer.ink/think/5cd0160be03d2.html
Solution for automatic update of Chinese word segmentation full-text index in NEO4J的更多相关文章
- 长短时间记忆的中文分词 (LSTM for Chinese Word Segmentation)
翻译学长的一片论文:Long Short-Term Memory Neural Networks for Chinese Word Segmentation 传统的neural Model for C ...
- zpar使用方法之Chinese Word Segmentation
第一步在这里: http://people.sutd.edu.sg/~yue_zhang/doc/doc/qs.html 你可以找到这句话, 所以在命令行中分别敲入 make zpar make zp ...
- 论文阅读及复现 | Effective Neural Solution for Multi-Criteria Word Segmentation
主要思想 这篇文章主要是利用多个标准进行中文分词,和之前复旦的那篇文章比,它的方法更简洁,不需要复杂的结构,但比之前的方法更有效. 方法 堆叠的LSTM,最上层是CRF. 最底层是字符集的Bi-LST ...
- The solution for apt-get update Err 404
最近在ubuntu 12.10上执行sudo apt-get update 命令后出现了如下错误: Ign http://extras.ubuntu.com natty/main Translatio ...
- Chinese word segment based on character representation learning 论文笔记
论文名和编号 摘要/引言 相关背景和工作 论文方法/模型 实验(数据集)及 分析(一些具体数据) 未来工作/不足 是否有源码 问题 原因 解决思路 优势 基于表示学习的中文分词 编号:1001-908 ...
- LIST OF NOSQL DATABASES [currently 150]
http://nosql-database.org Core NoSQL Systems: [Mostly originated out of a Web 2.0 need] Wide Column ...
- Pyhton开源框架(加强版)
info:Djangourl:https://www.oschina.net/p/djangodetail: Django 是 Python 编程语言驱动的一个开源模型-视图-控制器(MVC)风格的 ...
- Python开源框架
info:更多Django信息url:https://www.oschina.net/p/djangodetail: Django 是 Python 编程语言驱动的一个开源模型-视图-控制器(MVC) ...
- 【DeepLearning】一些资料
记录下,有空研究. http://nlp.stanford.edu/projects/DeepLearningInNaturalLanguageProcessing.shtml http://nlp. ...
随机推荐
- Jmeter(三) 从上传图片来入门Jmeter
用Jmeter上传用户头像到人人网 先用抓包工具Fiddler把上传操作的报文抓取下来 开启Jmeter,在测试计划中创建一个线程组,取名为“图片上传” 再在线程组中创建一个HTTP请求 在请求报文中 ...
- oracle 获取时间
1.获取当前时间的前24小时的各小时时间段 select to_char(to_date(to_char(sysdate ) ,'yyyy-mm-dd hh24') || ':00:00','yyyy ...
- ubuntu开启ssh服务时,报:start:Unknown job : ssh
这里是参考网站资料,并记录下. 如图所示: 解决方法: 输入以下命令即可 /usr/sbin/sshd mkdir /var/run/sshd /usr/sbin/sshd netstat -nlt ...
- Upload-libs通关详解
Uplo ad-labs—详解 1前端验证绕过 前端验证绕过可以直接用burp万能绕过前端JS脚本 方法先上传一张jpg Burp改包然后改后缀 上传成功 2Content-Type方式绕过 此绕过方 ...
- 实现图像添加label
void CmapwingisTest2View::OnToolsAddTiffLayer() { TCHAR szFilters[]= _T("TIFF Files (*.tif)|*.t ...
- 安装Dubbo 并且安装注册中心(Zookeeper-3.3.6)
安装zookeeper 安装Tomcat 载dubbo-admin-2.5.4.war 进入Apache ZooKeeper官方网站进行下载,https://zookeeper.apache.org/ ...
- C++入门经典-例3.7-用条件运算符判断数的奇偶性
1:条件运算符是一个三目运算符,能像判断语句一样完成判断.例如: max=(iA>iB) ? iA:iB; 意思是先判断iA是否大于iB,如果是,则max取iA的值,如果不是则取iB的值. 如果 ...
- Entity Framework Code First使用者的福音 --- EF Power Tool使用记之一
下次会为大家深入解析这个小工具. 最先看到这个工具是在EF产品组最新的博客文章上,http://blogs.msdn.com/b/adonet/archive/2011/05/18/ef-power ...
- SpringBoot通过@Value获取application.yml配置文件的属性值
application.yml实例: spring: redis: database: 0 host: 127.0.0.1 获取方法: /** * @Auther:WangZiBin * @Descr ...
- layui学习地址
--layui学习地址 ,相当之好用,非常感谢为我们工作和学习提供方便的才子们,谢谢~https://www.layui.com/demo/layim.html
