Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickschur committed Mar 14, 2017
2 parents dcd1421 + 8424d70 commit cffbd7b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Array

## API

### `__construct(array $result = [])`
#### `__construct(array $result = [])`
You can pass an array of languages to the constructor. To compare the desired sentence only with the given languages.
This can dramatically increase the performance.
```php
Expand All @@ -67,7 +67,7 @@ $ld->detect('Das ist ein Test');
```
<hr style="background-color:#666"/>

### `whitelist(string ...$whitelist)`
#### `whitelist(string ...$whitelist)`
Provide a whitelist. Returns a list of languages, which are required.
```php
$ld->detect('Mag het een onsje meer zijn?')->whitelist('de', 'nn', 'nl', 'af')->close();
Expand All @@ -84,7 +84,7 @@ Array
```
<hr style="background-color:#666"/>

### `blacklist(string ...$blacklist)`
#### `blacklist(string ...$blacklist)`
Provide a blacklist. Removes the given languages from the result.
```php
$ld->detect('Mag het een onsje meer zijn?')->blacklist('dk', 'nb', 'de')->close();
Expand All @@ -105,7 +105,7 @@ Array
```
<hr style="background-color:#666"/>

### `bestResults()`
#### `bestResults()`
Returns the best results.
```php
$ld->detect('Mag het een onsje meer zijn?')->bestResults()->close();
Expand All @@ -119,7 +119,7 @@ Array
```
<hr style="background-color:#666"/>

### `limit(int $offset, int $length = null)`
#### `limit(int $offset, int $length = null)`
You can specify the number of records to return. For example the following code will return the top three entries.
```php
$ld->detect('Mag het een onsje meer zijn?')->limit(0, 3)->close();
Expand All @@ -135,7 +135,7 @@ Array
```
<hr style="background-color:#666"/>

### `close()`
#### `close()`
Returns the result as an array.
```php
$ld->detect('This is an example!')->close();
Expand All @@ -154,7 +154,7 @@ Array
```
<hr style="background-color:#666"/>

### `setTokenizer(TokenizerInterface $tokenizer)`
#### `setTokenizer(TokenizerInterface $tokenizer)`
The script use a tokenizer for getting all words in a sentence.
You can define your own tokenizer to deal with numbers for example.
```php
Expand All @@ -169,7 +169,7 @@ $ld->setTokenizer(new class implements TokenizerInterface
This will return only characters from the alphabet in lowercase and numbers between 0 and 9.
<hr style="background-color:#666"/>

### `__toString()`
#### `__toString()`
Returns the top entrie of the result. Note the `echo` at the beginning.
```php
echo $ld->detect('Das ist ein Test.');
Expand All @@ -180,7 +180,7 @@ de
```
<hr style="background-color:#666"/>

### `jsonSerialize()`
#### `jsonSerialize()`
Serialized the data to JSON.
```php
$object = $ld->detect('Tere tulemast tagasi! Nägemist!');
Expand All @@ -200,7 +200,7 @@ Result:
```
<hr style="background-color:#666"/>

#### Method chaining
## Method chaining
You can also combine methods with each other.
The following example will remove all entries specified in the blacklist and returns only the top four entries.
```php
Expand All @@ -218,7 +218,7 @@ Array
```
<hr style="background-color:#666"/>

#### ArrayAccess
## ArrayAccess
You can also access the object directly as an array.
```php
$object = $ld->detect(Das ist ein Test');
Expand Down Expand Up @@ -369,4 +369,4 @@ The detection phase is only affected when you are trying to detect big chunks of
Feel free to contribute. Any help is welcome.

## License
This projects is licensed under the terms of the MIT license.
This projects is licensed under the terms of the MIT license.

0 comments on commit cffbd7b

Please sign in to comment.