Skip to content

Commit 2c9df5c

Browse files
authored
Enable code highlighting
1 parent a00e2f9 commit 2c9df5c

File tree

1 file changed

+42
-21
lines changed

1 file changed

+42
-21
lines changed

README.md

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,66 +11,87 @@ You can get it by signing up at https://detectlanguage.com
1111

1212
## Installation
1313

14-
pip install detectlanguage
14+
```
15+
pip install detectlanguage
16+
```
1517

1618
### Configuration
1719

18-
import detectlanguage
20+
```python
21+
import detectlanguage
1922

20-
detectlanguage.configuration.api_key = "YOUR API KEY"
23+
detectlanguage.configuration.api_key = "YOUR API KEY"
2124

22-
# Enable secure mode (SSL) if you are passing sensitive data
23-
# detectlanguage.configuration.secure = True
25+
# Enable secure mode (SSL) if you are passing sensitive data
26+
# detectlanguage.configuration.secure = True
27+
```
2428

2529
## Usage
2630

2731
### Language detection
2832

29-
detectlanguage.detect("Buenos dias señor")
33+
```python
34+
detectlanguage.detect("Buenos dias señor")
35+
```
3036

3137
#### Result
3238

33-
[{'isReliable': True, 'confidence': 12.04, 'language': 'es'}]
39+
```python
40+
[{'isReliable': True, 'confidence': 12.04, 'language': 'es'}]
41+
```
3442

3543
### Simple language detection
3644

3745
If you need just a language code you can use `simple_detect`. It returns just the language code.
3846

39-
detectlanguage.simple_detect("Buenos dias señor")
47+
```python
48+
detectlanguage.simple_detect("Buenos dias señor")
49+
```
4050

4151
#### Result
4252

43-
'es'
44-
53+
```python
54+
'es'
55+
```
4556

4657
### Batch detection
4758

4859
It is possible to detect language of several texts with one request.
4960
This method is faster than doing one request per text.
5061
To use batch detection just pass array of texts to `detect` method.
5162

52-
detectlanguage.detect(["Buenos dias señor", "Labas rytas"])
63+
```python
64+
detectlanguage.detect(["Buenos dias señor", "Labas rytas"])
65+
```
5366

5467
#### Result
5568

5669
Result is array of detections in the same order as the texts were passed.
5770

58-
[ [ {'isReliable': True, 'confidence': 12.04, 'language': 'es'} ],
59-
[ {'isReliable': True, 'confidence': 9.38, 'language': 'lt'} ] ]
71+
```python
72+
[ [ {'isReliable': True, 'confidence': 12.04, 'language': 'es'} ],
73+
[ {'isReliable': True, 'confidence': 9.38, 'language': 'lt'} ] ]
74+
```
6075

6176
### Getting your account status
6277

63-
detectlanguage.user_status()
78+
```python
79+
detectlanguage.user_status()
80+
```
6481

6582
#### Result
6683

67-
{ 'status': 'ACTIVE', 'daily_requests_limit': 5000, 'daily_bytes_limit': 1048576,
68-
'bytes': 3151, 'plan': 'FREE', 'date': '2014-03-29', 'requests': 263,
69-
'plan_expires': None }
84+
```python
85+
{ 'status': 'ACTIVE', 'daily_requests_limit': 5000, 'daily_bytes_limit': 1048576,
86+
'bytes': 3151, 'plan': 'FREE', 'date': '2014-03-29', 'requests': 263,
87+
'plan_expires': None }
88+
```
7089

7190
### Getting list detectable languages
7291

73-
detectlanguage.languages()
92+
```python
93+
detectlanguage.languages()
94+
```
7495

7596
#### Result
7697

@@ -82,9 +103,9 @@ You are welcome to patch and send GitHub pull requests.
82103

83104
### Testing
84105

85-
$ pip install -r requirements.txt
86-
$ pip install -r test-requirements.txt
87-
$ nosetests
106+
pip install -r requirements.txt
107+
pip install -r test-requirements.txt
108+
nosetests
88109

89110
## License
90111

0 commit comments

Comments
 (0)