| Name | quansyn JSON |
| Version |
0.0.2
JSON |
| download |
| home_page | https://github.com/YuhuYang/QuanSyn |
| Summary | A package for quantitative syntax analysis |
| upload_time | 2024-08-25 10:34:48 |
| maintainer | None |
| docs_url | None |
| author | Mu Yang |
| requires_python | >=3.6 |
| license | None |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# QuanSyn
QuanSyn: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
`QuanSyn` 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 `QuanSyn` via pip:
```bash
pip install quansyn
```
`nltk` and `conllu` are required.
```bash
pip install nltk conllu
```
## Quick Start
Here's a simple example of how to use `QuanSyn`:
### 1. depval
```bash
from quansyn.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 = getDepValFeatures(data)
print(dv)
```
### 2. lawfitter
```bash
from quansyn.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 quansyn.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://quansyn.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/QuanSyn",
"name": "quansyn",
"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/58/50/9c56046e91d0f6e66e62ee41ff5eb58af3cf18a45c957ac3d467d1e7a7b9/quansyn-0.0.2.tar.gz",
"platform": null,
"description": "# QuanSyn\nQuanSyn\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`QuanSyn` 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 `QuanSyn` via pip:\n\n```bash\npip install quansyn\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 `QuanSyn`:\n\n### 1. depval\n```bash\nfrom quansyn.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 = getDepValFeatures(data)\nprint(dv)\n```\n\n### 2. lawfitter\n\n```bash\nfrom quansyn.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 quansyn.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://quansyn.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 quantitative syntax analysis",
"version": "0.0.2",
"project_urls": {
"Homepage": "https://github.com/YuhuYang/QuanSyn"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "df97302c108ff62887a7b38bc441e5677ed76b417f0c6947b792888ab0bcf244",
"md5": "c1b98f9b1c5a06e5510facc4675cd23d",
"sha256": "bbd8f6d029854882fd5d59d1091bb434cad6fea0a5c2e8d56cc6b63291dfc563"
},
"downloads": -1,
"filename": "quansyn-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c1b98f9b1c5a06e5510facc4675cd23d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 10363,
"upload_time": "2024-08-25T10:34:47",
"upload_time_iso_8601": "2024-08-25T10:34:47.302464Z",
"url": "https://files.pythonhosted.org/packages/df/97/302c108ff62887a7b38bc441e5677ed76b417f0c6947b792888ab0bcf244/quansyn-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "58509c56046e91d0f6e66e62ee41ff5eb58af3cf18a45c957ac3d467d1e7a7b9",
"md5": "bac046e0c0c2857573716edf82404693",
"sha256": "457a852ffded290381e8df88416401717ae30d51ef0279e5b20ec1446f0f0ecb"
},
"downloads": -1,
"filename": "quansyn-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "bac046e0c0c2857573716edf82404693",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 11372,
"upload_time": "2024-08-25T10:34:48",
"upload_time_iso_8601": "2024-08-25T10:34:48.832897Z",
"url": "https://files.pythonhosted.org/packages/58/50/9c56046e91d0f6e66e62ee41ff5eb58af3cf18a45c957ac3d467d1e7a7b9/quansyn-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-25 10:34:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "YuhuYang",
"github_project": "QuanSyn",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "quansyn"
}