commit 430115a6e02534e0453dc5bda455ec9e0218b136 Author: vaydheesh Date: Mon Aug 12 12:31:58 2019 +0530 updated: readme diff --git a/README.md b/README.md index 1247425..29a8292 100644 --- a/README.md +++ b/README.md @@ -6,32 +6,32 @@ [![Coverage Status](https://coveralls.io/repos/github/apertium/apertium-python/badge.svg?branch=master)](https://coveralls.io/github/apertium/apertium-python?branch=master) ## Introduction -- The code-base is in development for the Gsoc '18 project called **Apertium API in Python** +- The code-base is in development for the GSoC '19 project called **Apertium API in Python** - The Apertium core modules are written in C++. - This project is an attempt to make the Apertium modules available in python, which because of it's simplicity is more appealing to users. ## About the Exisiting Code Base -- The exisiting code base has the subprocess implementation of the basic functions of Apertium. -- A branch called the ```windows``` has the implementation for the ```windows``` support and will soon be available on master. Detailed instructions can be found [here](https://gist.github.com/arghyatiger/c8aab476022158f4bdb3dbe45308cdb4) +- The exisiting code base has the subprocess and swig wrapper implementation of the basic functions of Apertium. -## Major things to do -- Subprocess implementation of the C++ functions in Apertium. To make the wrapper thinner. -- Other small issues can be found [here](https://github.com/apertium/apertium-python/issues) +## ToDo +- ToDo is present in form of issues https://github.com/apertium/apertium-python/issues ## Usage of library +- For multiple invocations `Method 1` is more performant, as the dictionary needs to be loaded only once. + ### Analysis Performing Morphological Analysis -Method 1: One can create ```Analyzer``` objects on which ```analyze()``` function can be run. -```python +Method 1: Create `Analyzer` object and call its `analyze()` method. +``` In [1]: import apertium In [2]: a = apertium.Analyzer('en') In [3]: a.analyze('cats') Out[3]: [cats/cat, ./.] ``` -Method 2: Alternatively, the library provides an option to directly run the ```analyze``` method. -```python +Method 2: Calling `analyze` method directly. +``` In [1]: import apertium In [2]: apertium.analyze('en', 'cats') Out[2]: cats/cat @@ -40,15 +40,15 @@ Out[2]: cats/cat ### Generation Performing Morphological Generation -Method 1: Just like the ```Analyzer```, One can create ```Generator``` objects on which ```generate()``` function can be run. -```python +Method 1: Create `Generator` and call its `generate()` method. +``` In [1]: import apertium In [2]: g = apertium.Generator('en') In [3]: g.generate('^cat$') Out[3]: 'cats' ``` -Method 2: Running ```generate()``` directly. -```python +Method 2: Calling `generate()` directly. +``` In [1]: import apertium In [2]: apertium.generate('en', '^cat$') Out[2]: 'cats' @@ -56,36 +56,36 @@ Out[2]: 'cats' ### Installing more modes from other language data One can also install modes by providing the path to the lang-data using this simple function -```python +``` In [1]: import apertium In [2]: apertium.append_pair_path('..') ``` ### Tagger -Method 1: One can create ```Tagger``` objects on which ```tag()``` function can be run. -```python +Method 1: Create `Tagger` object and call its `tag` method. +``` In [1]: import apertium In [2]: tagger = apertium.Tagger('eng') In [3]: tagger.tag('cats') Out[3]: [cats/cat] ``` -Method 2: Running ```tag()``` directly. -```python +Method 2: Calling `tag()` directly. +``` In [1]: import apertium In [2]: apertium.tag('en', 'cats') Out[2]: [cats/cat] ``` ### Translation -Method 1: One can create ```Translator``` objects on which ```translate()``` function can be run. -```python +Method 1: Create `Translator` object and call its `translate()` method. +``` In [1]: import apertium In [2]: t = apertium.Translator('eng', 'spa') In [3]: t.translate('cats') Out[3]: 'Gatos' ``` -Method 2: Running ```translate()``` directly. -```python +Method 2: Calling `translate()` directly. +``` In [1]: import apertium In [2]: apertium.translate('en', 'spa', 'cats') Out[2]: 'Gatos'