You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- The code-base is in development for the Gsoc '18 project called **Apertium API in Python**
9
+
- The code-base is in development for the GSoC '19 project called **Apertium API in Python**
10
10
- The Apertium core modules are written in C++.
11
11
- This project is an attempt to make the Apertium modules available in python, which because of it's simplicity is more appealing to users.
12
12
13
13
## About the Exisiting Code Base
14
-
- The exisiting code base has the subprocess implementation of the basic functions of Apertium.
15
-
- 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)
14
+
- The exisiting code base has the subprocess and swig wrapper implementation of the basic functions of Apertium.
16
15
17
-
## Major things to do
18
-
- Subprocess implementation of the C++ functions in Apertium. To make the wrapper thinner.
19
-
- Other small issues can be found [here](https://github.com/apertium/apertium-python/issues)
16
+
## ToDo
17
+
- ToDo is present in form of issues https://github.com/apertium/apertium-python/issues
20
18
21
19
## Usage of library
22
20
21
+
- For multiple invocations `Method 1` is more performant, as the dictionary needs to be loaded only once.
22
+
23
23
### Analysis
24
24
Performing Morphological Analysis
25
25
26
-
Method 1: One can create ```Analyzer``` objects on which ```analyze()``` function can be run.
27
-
```python
26
+
Method 1: Create `Analyzer` object and call its `analyze()` method.
27
+
```
28
28
In [1]: import apertium
29
29
In [2]: a = apertium.Analyzer('en')
30
30
In [3]: a.analyze('cats')
31
31
Out[3]: [cats/cat<n><pl>, ./.<sent>]
32
32
```
33
-
Method 2: Alternatively, the library provides an option to directly run the ```analyze``` method.
34
-
```python
33
+
Method 2: Calling `analyze` method directly.
34
+
```
35
35
In [1]: import apertium
36
36
In [2]: apertium.analyze('en', 'cats')
37
37
Out[2]: cats/cat<n><pl>
@@ -40,52 +40,52 @@ Out[2]: cats/cat<n><pl>
40
40
### Generation
41
41
Performing Morphological Generation
42
42
43
-
Method 1: Just like the ```Analyzer```, One can create ```Generator``` objects on which ```generate()``` function can be run.
44
-
```python
43
+
Method 1: Create `Generator` and call its `generate()` method.
44
+
```
45
45
In [1]: import apertium
46
46
In [2]: g = apertium.Generator('en')
47
47
In [3]: g.generate('^cat<n><pl>$')
48
48
Out[3]: 'cats'
49
49
```
50
-
Method 2: Running ```generate()``` directly.
51
-
```python
50
+
Method 2: Calling `generate()` directly.
51
+
```
52
52
In [1]: import apertium
53
53
In [2]: apertium.generate('en', '^cat<n><pl>$')
54
54
Out[2]: 'cats'
55
55
```
56
56
57
57
### Installing more modes from other language data
58
58
One can also install modes by providing the path to the lang-data using this simple function
59
-
```python
59
+
```
60
60
In [1]: import apertium
61
61
In [2]: apertium.append_pair_path('..')
62
62
```
63
63
64
64
### Tagger
65
-
Method 1: One can create ```Tagger``` objects on which ```tag()``` function can be run.
66
-
```python
65
+
Method 1: Create `Tagger` object and call its `tag` method.
66
+
```
67
67
In [1]: import apertium
68
68
In [2]: tagger = apertium.Tagger('eng')
69
69
In [3]: tagger.tag('cats')
70
70
Out[3]: [cats/cat<n><pl>]
71
71
```
72
-
Method 2: Running ```tag()``` directly.
73
-
```python
72
+
Method 2: Calling `tag()` directly.
73
+
```
74
74
In [1]: import apertium
75
75
In [2]: apertium.tag('en', 'cats')
76
76
Out[2]: [cats/cat<n><pl>]
77
77
```
78
78
79
79
### Translation
80
-
Method 1: One can create ```Translator``` objects on which ```translate()``` function can be run.
81
-
```python
80
+
Method 1: Create `Translator` object and call its `translate()` method.
0 commit comments