# QuantLing
QuantLing:A python package for quantitative syntax analysis.
[](https://badge.fury.io/py/PackageName)
[](https://travis-ci.org/user/package)
[](https://opensource.org/licenses/MIT)
## Description
`QuantLing` is a Python package for Quantitative Linguistics. It provides functionality to quantify linguistic structures and explore language patterns.
This package is consisted of three main parts:
- `depval.py`: some indicators about dependency structures and valency structures.
- `lawfitter.py`: a small fitter for some laws in QL.
- `lingnet.py`: a module for complex network construction.
## Installation
You can install `QuantLing` via pip:
```bash
pip install quantling
```
`nltk` and `conllu` are required.
```bash
pip install nltk conllu
```
## Quick Start
Here's a simple example of how to use `QuantLing`:
### 1. depval
```bash
from quantling.depval import DepValAnalyzer
data = open(r'your_treebank.conllu',encoding='utf-8')
dv = DependencyAnalyzer(data)
# dependency distance distribution
dv.dd_distribution()
# mean dependency distance of specific wordclasses
dv.mdd(pos='NOUN')
# mean dependency distance of specific dependency relations
dv.mdd(dependency='nsubj')
# proportion of dependency distance
dv.pdd()
# tree width and tree depth
dv.tree()
# tree width distirbution and tree depth distribution
dv.tree_distribution()
# mean valency
dv.mean_valency()
# valency distribution
dv.valency_distribution()
# probalistic valency pattern
dv.pvp()
```
or:
```bash
dv = getDepFeatures(data)
print(dv)
```
### 2. lawfitter
```bash
from quantling.lawfitter import fit
#results = fit(data,model,variant)
results = fit([[1,2,3,4,5,6],[3,4,2,6,8,15]],'zipf')
print(resluts)
```
### 3. lingnet
```bash
from quantling.lingnet import conllu2edge
import networkx as nx
# use a conllu file to construction a network
data = open(r'your_treebank.conllu',encoding='utf-8')
edges = conllu2edge(data,mode='dependency')
# or to construct a co-occurance network
#edges = conllu2edge(data,mode='adjacency')
G = nx.Graph()
G.add_edges_from(edges)
# to estimate the degree exponents
degree =[i[1] for i in G.degree()]
degree_exponents = fitPowerLaw(degree)
print(degree_exponents)
```
## Documentation
For more detailed information, please refer to the [video (in Chinese)](https://quantling.readthedocs.io/).
## Features
- Dependency distance distribution
- Mean dependency distance of specific wordclasses
- Mean dependency distance of specific dependency relations
- Proportion of dependency distance
- Tree width and tree depth
- Tree width distribution and tree depth distribution
- Mean valency
- Valency distribution
- Probabilistic valency pattern
- Law fitter
- Complex network construction
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Contact
- GitHub: [@YuhuYang](https://github.com/YuhuYang)
- Email: yangmufy@163.com
## Citing
If our project has been helpful to you, please give it a star and cite our articles. We would be very grateful.
```
@article{Yang_2022,
doi = {10.1209/0295-5075/ac8bf2},
url = {https://dx.doi.org/10.1209/0295-5075/ac8bf2},
year = {2022},
month = {sep},
publisher = {EDP Sciences, IOP Publishing and Società Italiana di Fisica},
volume = {139},
number = {6},
pages = {61002},
author = {Mu Yang and Haitao Liu},
title = {The role of syntax in the formation of scale-free language networks},
journal = {Europhysics Letters},
abstract = {The overall structure of a network is determined by its micro features, which are different in both syntactic and non-syntactic networks. However, the fact that most language networks are small-world and scale-free raises the question: does syntax play a role in forming the scale-free feature? To answer this question, we build syntactic networks and co-occurrence networks to compare the generation mechanisms of nodes, and to investigate whether syntactic and non-syntactic factors have distinct roles. The results show that frequency is the foundation of the scale-free feature, while syntax is beneficial to enhance this feature. This research introduces a microscopic approach, which may shed light on the scale-free feature of language networks.}
}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/YuhuYang/QuantLing",
"name": "quantling",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Mu Yang",
"author_email": "yuhuyang@163.com",
"download_url": "https://files.pythonhosted.org/packages/51/18/0ffa0608a410674b7a07f85c2561ab698031a0026ef53d9af7255b778cc3/quantling-0.1.1.tar.gz",
"platform": null,
"description": "# QuantLing\nQuantLing\uff1aA python package for quantitative syntax analysis.\n\n\n[](https://badge.fury.io/py/PackageName)\n[](https://travis-ci.org/user/package)\n[](https://opensource.org/licenses/MIT)\n\n## Description\n\n`QuantLing` is a Python package for Quantitative Linguistics. It provides functionality to quantify linguistic structures and explore language patterns.\n\nThis package is consisted of three main parts:\n- `depval.py`: some indicators about dependency structures and valency structures.\n- `lawfitter.py`: a small fitter for some laws in QL.\n- `lingnet.py`: a module for complex network construction.\n\n\n## Installation\n\nYou can install `QuantLing` via pip:\n\n```bash\npip install quantling\n```\n\n`nltk` and `conllu` are required.\n\n```bash\npip install nltk conllu\n```\n\n## Quick Start\n\nHere's a simple example of how to use `QuantLing`:\n\n### 1. depval\n```bash\nfrom quantling.depval import DepValAnalyzer \ndata = open(r'your_treebank.conllu',encoding='utf-8')\ndv = DependencyAnalyzer(data) \n\n# dependency distance distribution\ndv.dd_distribution()\n# mean dependency distance of specific wordclasses\ndv.mdd(pos='NOUN')\n# mean dependency distance of specific dependency relations\ndv.mdd(dependency='nsubj')\n# proportion of dependency distance\ndv.pdd()\n# tree width and tree depth\ndv.tree()\n# tree width distirbution and tree depth distribution\ndv.tree_distribution()\n\n# mean valency\ndv.mean_valency()\n# valency distribution\ndv.valency_distribution()\n# probalistic valency pattern \ndv.pvp()\n```\nor:\n```bash\ndv = getDepFeatures(data)\nprint(dv)\n```\n\n### 2. lawfitter\n\n```bash\nfrom quantling.lawfitter import fit \n#results = fit(data,model,variant)\nresults = fit([[1,2,3,4,5,6],[3,4,2,6,8,15]],'zipf')\nprint(resluts)\n```\n\n### 3. lingnet\n\n```bash\nfrom quantling.lingnet import conllu2edge\nimport networkx as nx \n# use a conllu file to construction a network\ndata = open(r'your_treebank.conllu',encoding='utf-8')\nedges = conllu2edge(data,mode='dependency')\n# or to construct a co-occurance network \n#edges = conllu2edge(data,mode='adjacency')\nG = nx.Graph()\nG.add_edges_from(edges)\n\n# to estimate the degree exponents\ndegree =[i[1] for i in G.degree()]\ndegree_exponents = fitPowerLaw(degree)\nprint(degree_exponents)\n```\n\n## Documentation\n\nFor more detailed information, please refer to the [video (in Chinese)](https://quantling.readthedocs.io/).\n\n\n## Features\n\n- Dependency distance distribution\n- Mean dependency distance of specific wordclasses\n- Mean dependency distance of specific dependency relations\n- Proportion of dependency distance\n- Tree width and tree depth\n- Tree width distribution and tree depth distribution\n- Mean valency\n- Valency distribution\n- Probabilistic valency pattern\n- Law fitter\n- Complex network construction\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Contact\n\n- GitHub: [@YuhuYang](https://github.com/YuhuYang)\n- Email: yangmufy@163.com\n\n## Citing\n\nIf our project has been helpful to you, please give it a star and cite our articles. We would be very grateful.\n\n```\n@article{Yang_2022,\ndoi = {10.1209/0295-5075/ac8bf2},\nurl = {https://dx.doi.org/10.1209/0295-5075/ac8bf2},\nyear = {2022},\nmonth = {sep},\npublisher = {EDP Sciences, IOP Publishing and Societ\u00e0 Italiana di Fisica},\nvolume = {139},\nnumber = {6},\npages = {61002},\nauthor = {Mu Yang and Haitao Liu},\ntitle = {The role of syntax in the formation of scale-free language networks},\njournal = {Europhysics Letters},\nabstract = {The overall structure of a network is determined by its micro features, which are different in both syntactic and non-syntactic networks. However, the fact that most language networks are small-world and scale-free raises the question: does syntax play a role in forming the scale-free feature? To answer this question, we build syntactic networks and co-occurrence networks to compare the generation mechanisms of nodes, and to investigate whether syntactic and non-syntactic factors have distinct roles. The results show that frequency is the foundation of the scale-free feature, while syntax is beneficial to enhance this feature. This research introduces a microscopic approach, which may shed light on the scale-free feature of language networks.}\n}\n``` \n",
"bugtrack_url": null,
"license": null,
"summary": "A package for quantiative linguistics",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/YuhuYang/QuantLing"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c6a91713c09517be4b525536529597ecec3d8327e3e9e51f0e451cd848c31a13",
"md5": "892e88b4bfa2bb9e442c717f001c4d8e",
"sha256": "71f983102d4f95440657ad5cb581742a6ddbebf85490d967a44f77c3008cf3dc"
},
"downloads": -1,
"filename": "quantling-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "892e88b4bfa2bb9e442c717f001c4d8e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 10410,
"upload_time": "2024-08-21T01:47:46",
"upload_time_iso_8601": "2024-08-21T01:47:46.257357Z",
"url": "https://files.pythonhosted.org/packages/c6/a9/1713c09517be4b525536529597ecec3d8327e3e9e51f0e451cd848c31a13/quantling-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "51180ffa0608a410674b7a07f85c2561ab698031a0026ef53d9af7255b778cc3",
"md5": "c9dbf6c13f5c9b3e80f742db2026820d",
"sha256": "dd8be2706aec3622ed46545ec371bd2b811526d25556b56e3b72e0d8a64eac52"
},
"downloads": -1,
"filename": "quantling-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "c9dbf6c13f5c9b3e80f742db2026820d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 11395,
"upload_time": "2024-08-21T01:47:48",
"upload_time_iso_8601": "2024-08-21T01:47:48.503356Z",
"url": "https://files.pythonhosted.org/packages/51/18/0ffa0608a410674b7a07f85c2561ab698031a0026ef53d9af7255b778cc3/quantling-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-21 01:47:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "YuhuYang",
"github_project": "QuantLing",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "quantling"
}