-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yeray Diaz Diaz
committed
Apr 15, 2018
1 parent
c566cca
commit 6536880
Showing
8 changed files
with
78 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Language support | ||
|
||
An optional and experimental support for other languages via the [Natural Language Toolkit](http://www.nltk.org/) stemmers. To install Lunr with this feature use `pip install lunr[languages]`. | ||
|
||
Assuming you have a set of documents in one of the supported languages: | ||
|
||
- arabic | ||
- danish | ||
- dutch | ||
- english | ||
- finnish | ||
- french | ||
- german | ||
- hungarian | ||
- italian | ||
- norwegian | ||
- portuguese | ||
- romanian | ||
- russian | ||
- spanish | ||
- swedish | ||
|
||
```python | ||
>>> documents = [ | ||
... { | ||
... "id": "a", | ||
... "text": ( | ||
... "Este es un ejemplo inventado de lo que sería un documento en el " | ||
... "idioma que se más se habla en España."), | ||
... "title": "Ejemplo de documento en español" | ||
... }, | ||
... { | ||
... "id": "b", | ||
... "text": ( | ||
... "Según un estudio que me acabo de inventar porque soy un experto en" | ||
... "idiomas que se hablan en España."), | ||
... "title": "Español es el tercer idioma más hablado del mundo" | ||
... }, | ||
... ] | ||
``` | ||
|
||
Simply define specify the [ISO-639-1 code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) for the language of you documents as a parameter to the `lunr` function: | ||
|
||
```python | ||
>>> from lunr import lunr | ||
>>> idx = lunr('id', ['title', 'text'], documents, language='es') | ||
>>> idx.search('inventando') | ||
[{'ref': 'a', 'score': 0.1300928764641503, 'match_data': <MatchData "invent">}, | ||
{'ref': 'b', 'score': 0.08967151299297255, 'match_data': <MatchData "invent">}] | ||
``` | ||
|
||
Please note compatibility with Lunr.js might be affected when using this feature. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ site_name: Lunr.py | |
pages: | ||
- Home: index.md | ||
- Searching: usage.md | ||
- Languages: languages.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
twine==1.11.0 | ||
mkdocs==0.17.3 | ||
pytest-benchmark==3.1.1 | ||
wheel==0.31.0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters