Skip to content
Snippets Groups Projects
Commit b02d9677 authored by Mathieu Loiseau's avatar Mathieu Loiseau
Browse files

update readme

parent 8dbb5366
No related branches found
No related tags found
No related merge requests found
...@@ -14,11 +14,11 @@ This project does depend on python packages. ...@@ -14,11 +14,11 @@ This project does depend on python packages.
* [``importlib``](https://docs.python.org/3/library/importlib.html) : to import parser modules * [``importlib``](https://docs.python.org/3/library/importlib.html) : to import parser modules
## Installation ## Installation
(maybe to be replaced by an automation of some sort) (maybe to be replaced by an automation of some sort, using a virtual environment might be better, see [server version](#wikstraktor-server))
* [```pip install pywikibot```](https://pypi.org/project/pywikibot/) * [```pip install pywikibot```](https://pypi.org/project/pywikibot/)
* [```pip install wikitextparser```](https://pypi.org/project/wikitextparser/) * [```pip install wikitextparser```](https://pypi.org/project/wikitextparser/)
* [```pip install importlib```](https://pypi.org/project/importlib/) * [```pip install importlib```](https://pypi.org/project/importlib/)
_Optional (for python 2.*)_ _Optional (for python 2.*, not tested)_
### Wikstraktor Server ### Wikstraktor Server
If you want wikstraktor as a server, you need to install [flask](https://flask.palletsprojects.com/en/2.0.x/installation/) and [flask-cors](https://flask-cors.readthedocs.io/en/latest/) — to allow other domains to query —, and best practice is to do so in a [virtual environment](https://docs.python.org/3/library/venv.html#module-venv). If you want wikstraktor as a server, you need to install [flask](https://flask.palletsprojects.com/en/2.0.x/installation/) and [flask-cors](https://flask-cors.readthedocs.io/en/latest/) — to allow other domains to query —, and best practice is to do so in a [virtual environment](https://docs.python.org/3/library/venv.html#module-venv).
...@@ -33,6 +33,7 @@ pip install -U flask-cors #install Flask cors ...@@ -33,6 +33,7 @@ pip install -U flask-cors #install Flask cors
## Use ## Use
### Wikstraktor ### Wikstraktor
#### Python
```python ```python
from wikstraktor import Wikstraktor from wikstraktor import Wikstraktor
f = Wikstraktor.get_instance('fr', 'en') #create a wikstraktor, f = Wikstraktor.get_instance('fr', 'en') #create a wikstraktor,
...@@ -42,6 +43,30 @@ f.fetch("blue") #fetch an article ...@@ -42,6 +43,30 @@ f.fetch("blue") #fetch an article
str(f) #convert content to json str(f) #convert content to json
``` ```
#### Bash
```
usage: wikstraktor.py [-h] [-l LANGUAGE] [-w WIKI_LANGUAGE] [-m MOT]
[-f DESTINATION_FILE] [-A] [-C]
Interroger un wiktionnaire
ex :
‣./wikstraktor.py -m blue
‣./wikstraktor.py -m blue -f blue.json -A -C
‣./wikstraktor.py -l en -w fr -m blue -f blue.json -A -C
options:
-h, --help show this help message and exit
-l LANGUAGE, --language LANGUAGE
la langue du mot
-w WIKI_LANGUAGE, --wiki_language WIKI_LANGUAGE
la langue du wiki
-m MOT, --mot MOT le mot à chercher
-f DESTINATION_FILE, --destination_file DESTINATION_FILE
le fichier dans lequel stocker le résultat
-A, --force_ascii json avec que des caractères ascii
-C, --compact json sans indentation
```
### Wikstraktor Server ### Wikstraktor Server
The server runs by default on port 5000, you can change that in the ```wikstraktor_server_config.py``` file. The server runs by default on port 5000, you can change that in the ```wikstraktor_server_config.py``` file.
```bash ```bash
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment