@@ -23,60 +23,58 @@ import detectlanguage
23
23
detectlanguage.configuration.api_key = " YOUR API KEY"
24
24
25
25
# You can use proxy if needed
26
- # detectlanguage.configuration.proxies = {'https': 'https://user:pass@proxy.example.com :8080'}
26
+ # detectlanguage.configuration.proxies = {'https': 'https://user:pass@proxy:8080'}
27
27
```
28
28
29
29
## Usage
30
30
31
31
### Language detection
32
32
33
33
``` python
34
- detectlanguage.detect(" Buenos dias señor " )
34
+ detectlanguage.detect(" Dolce far niente " )
35
35
```
36
36
37
37
#### Result
38
38
39
39
``` python
40
- [{' isReliable ' : True , ' confidence ' : 12.04 , ' language ' : ' es ' }]
40
+ [{' language ' : ' it ' , ' score ' : 0.5074 }]
41
41
```
42
42
43
43
### Simple language detection
44
44
45
- If you need just a language code you can use ` simple_detect ` . It returns just the language code .
45
+ If you need just a language code you can use ` detect_code ` .
46
46
47
47
``` python
48
- detectlanguage.simple_detect( " Buenos dias señor " )
48
+ detectlanguage.detect_code( " Dolce far niente " )
49
49
```
50
50
51
51
#### Result
52
52
53
53
``` python
54
- ' es '
54
+ ' it '
55
55
```
56
56
57
57
### Batch detection
58
58
59
59
It is possible to detect language of several texts with one request.
60
60
This method is faster than doing one request per text.
61
- To use batch detection just pass array of texts to ` detect ` method.
62
61
63
62
``` python
64
- detectlanguage.detect ([" Buenos dias señor " , " Labas rytas " ])
63
+ detectlanguage.detect_batch ([" Dolce far niente " , " Hello world " ])
65
64
```
66
65
67
66
#### Result
68
67
69
68
Result is array of detections in the same order as the texts were passed.
70
69
71
70
``` python
72
- [ [ {' isReliable' : True , ' confidence' : 12.04 , ' language' : ' es' } ],
73
- [ {' isReliable' : True , ' confidence' : 9.38 , ' language' : ' lt' } ] ]
71
+ [[{' language' : ' it' , ' score' : 0.5074 }], [{' language' : ' en' , ' score' : 0.9098 }]]
74
72
```
75
73
76
74
### Getting your account status
77
75
78
76
``` python
79
- detectlanguage.user_status ()
77
+ detectlanguage.account_status ()
80
78
```
81
79
82
80
#### Result
@@ -95,7 +93,9 @@ detectlanguage.languages()
95
93
96
94
#### Result
97
95
98
- Array of language codes and names.
96
+ ``` python
97
+ [{' code' : ' aa' , ' name' : ' Afar' }, {' code' : ' ab' , ' name' : ' Abkhazian' }, ... ]
98
+ ```
99
99
100
100
## Contribution
101
101
0 commit comments