@@ -15,68 +15,70 @@ You can get it by signing up at https://detectlanguage.com
15
15
pip install detectlanguage
16
16
```
17
17
18
+ ### Upgrading
19
+
20
+ When upgrading please check [ changelog] ( CHANGELOG.md ) for breaking changes.
21
+
18
22
### Configuration
19
23
20
24
``` python
21
25
import detectlanguage
22
26
23
27
detectlanguage.configuration.api_key = " YOUR API KEY"
24
28
25
- # Enable secure mode (SSL) if you are passing sensitive data
26
- # detectlanguage.configuration.secure = True
29
+ # You can use proxy if needed
30
+ # detectlanguage.configuration.proxies = {'https': 'https://user:pass@proxy:8080'}
27
31
```
28
32
29
33
## Usage
30
34
31
- ### Language detection
35
+ ### Detect language
32
36
33
37
``` python
34
- detectlanguage.detect(" Buenos dias señor " )
38
+ detectlanguage.detect(" Dolce far niente " )
35
39
```
36
40
37
41
#### Result
38
42
39
43
``` python
40
- [{' isReliable ' : True , ' confidence ' : 12.04 , ' language ' : ' es ' }]
44
+ [{' language ' : ' it ' , ' score ' : 0.5074 }]
41
45
```
42
46
43
- ### Simple language detection
47
+ ### Detect single code
44
48
45
- If you need just a language code you can use ` simple_detect ` . It returns just the language code .
49
+ If you need just a language code you can use ` detect_code ` .
46
50
47
51
``` python
48
- detectlanguage.simple_detect( " Buenos dias señor " )
52
+ detectlanguage.detect_code( " Dolce far niente " )
49
53
```
50
54
51
55
#### Result
52
56
53
57
``` python
54
- ' es '
58
+ ' it '
55
59
```
56
60
57
61
### Batch detection
58
62
59
63
It is possible to detect language of several texts with one request.
60
64
This method is faster than doing one request per text.
61
- To use batch detection just pass array of texts to ` detect ` method.
62
65
63
66
``` python
64
- detectlanguage.detect ([" Buenos dias señor " , " Labas rytas " ])
67
+ detectlanguage.detect_batch ([" Dolce far niente " , " Hello world " ])
65
68
```
66
69
67
70
#### Result
68
71
69
72
Result is array of detections in the same order as the texts were passed.
70
73
71
74
``` python
72
- [ [ {' isReliable' : True , ' confidence' : 12.04 , ' language' : ' es' } ],
73
- [ {' isReliable' : True , ' confidence' : 9.38 , ' language' : ' lt' } ] ]
75
+ [[{' language' : ' it' , ' score' : 0.5074 }], [{' language' : ' en' , ' score' : 0.9098 }]]
74
76
```
75
77
76
- ### Getting your account status
78
+ ### Get your account status
77
79
78
80
``` python
79
- detectlanguage.user_status ()
81
+ detectlanguage.account_status ()
80
82
```
81
83
82
84
#### Result
@@ -87,25 +89,17 @@ detectlanguage.user_status()
87
89
' plan_expires' : None }
88
90
```
89
91
90
- ### Getting list detectable languages
92
+ ### Get list of supported languages
91
93
92
94
``` python
93
95
detectlanguage.languages()
94
96
```
95
97
96
98
#### Result
97
99
98
- Array of language codes and names.
99
-
100
- ## Contribution
101
-
102
- You are welcome to patch and send GitHub pull requests.
103
-
104
- ### Testing
105
-
106
- pip install -r requirements.txt
107
- pip install -r test-requirements.txt
108
- nosetests
100
+ ``` python
101
+ [{' code' : ' aa' , ' name' : ' Afar' }, {' code' : ' ab' , ' name' : ' Abkhazian' }, ... ]
102
+ ```
109
103
110
104
## License
111
105
0 commit comments