项目作者: alexeyev

项目描述 :
/ru/ConceptNet5.7 Python wrapper
高级语言: Python
项目地址: git://github.com/alexeyev/RuConceptNet.git
创建时间: 2020-11-19T14:01:45Z
项目社区:https://github.com/alexeyev/RuConceptNet

开源协议:MIT License

下载


/ru/ConceptNet

ConceptNet 5.7 (Russian part) extraction scripts + fast API object to access the relations. Note: a simple modification of the
preprocessing script allows to build a queryable graph of any other subset of ConceptNet.

Python 3x
PyPI version
Downloads

Installation

  1. pip install ruconceptnet

Usage

  1. >>> from ruconceptnet import ConceptNet
  2. >>> cn = ConceptNet()
  3. >>> cn.get_targets("алкоголь")
  4. [('этиловый_спирт', {'Synonym'}), ('спиртной_напиток', {'Synonym'}), ('алкогольный', {'RelatedTo'}),
  5. ('алкоголик', {'RelatedTo'}), ('спирт', {'Synonym'}), ('алкоголизация', {'RelatedTo'})]
  6. >>> cn.get_sources("йога")
  7. [('йоги', {'FormOf'}), ('йогу', {'FormOf'}), ('йогический', {'RelatedTo'}), ('йогою', {'FormOf'}),
  8. ('йогой', {'FormOf'}), ('йог', {'RelatedTo'}), ('йоге', {'FormOf'})]
  9. >>> cn.check_pair("человек", "зверь")
  10. (['DistinctFrom'], [])
  11. >>> cn.check_pair("зверь", "человек")
  12. ([], ['DistinctFrom'])

Preparations for customization

Please see the prepare_data.sh script. We get the Russian-Russian pairs of nodes with simple grep and build
a 3-dimensional array (source, target, relation) stored as a single sparse SciPy matrix.

Citing

Please do not forget to cite the ConceptNet5 paper.

  1. @inproceedings{10.5555/3298023.3298212,
  2. author = {Speer, Robyn and Chin, Joshua and Havasi, Catherine},
  3. title = {ConceptNet 5.5: An Open Multilingual Graph of General Knowledge},
  4. year = {2017},
  5. publisher = {AAAI Press},
  6. booktitle = {Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence},
  7. pages = {44444451},
  8. numpages = {8},
  9. location = {San Francisco, California, USA},
  10. series = {AAAI'17}
  11. }

Citing the repository is not necessary, but greatly appreciated as well, if you use this work.

  1. @misc{ruconceptnet2020alekseev,
  2. title = {{alexeyev/RuConceptNet: /ru/ConceptNet5.7 Python wrapper }},
  3. year = {2020},
  4. url = {https://github.com/alexeyev/RuConceptNet},
  5. language = {english}
  6. }

License

The code is released under the MIT license (please see the LICENSE file).

This work includes a subset data from ConceptNet 5, which was compiled by the
Commonsense Computing Initiative. ConceptNet 5 is freely available under
the Creative Commons Attribution-ShareAlike license (CC BY SA 3.0) from
http://conceptnet.io.

The included data was created by contributors to Commonsense Computing
projects, contributors to Wikimedia projects, DBPedia, OpenCyc, Games
with a Purpose, Princeton University’s WordNet, Francis Bond’s Open
Multilingual WordNet, and Jim Breen’s JMDict.

The complete data in ConceptNet is available under the Creative Commons Attribution-ShareAlike 4.0 license.

For more details, please see “Copying and sharing ConceptNet”.