Additional Language Support
How can I add another language?
Same question here: where one should begin in order to add support for other languages? Would be glad to lend a hand...
+1. I would gladly lend a hand.
Thanks everyone. I'll say a bit more about what's blocking this.
The lexemes.bin data file has been constructed in a way that depends on various intermediate data files --- for instance, I processed an unannotated corpus into a list of word counts, and then smoothed the counts with another script, and then consumed the smoothed probabilities with the current quick-and-dirty make_lexicon.py script, which isn't even in this repository yet. I also need to set up a program to generate Brown clusters, and configure word2vec to generate word vectors.
Finally, I need to document the process, and document the tokenizer file formats, so that I can describe what you'll actually need to do to add new languages.
Instead of doing these things, I've mostly been doing bug-fixes, improving the API docs, and trying to improve my deployment process, which at the moment feels very error-prone.
I'll say a little bit about what will be required to add new languages.
- Select an unannotated corpus. This will probably be Wikipedia --- it's a nice way to streamline things across languages. Another nice solution would be to run a language identification program over Common Crawl dumps, so that we can get text from wider genres.
- Select an annotated corpus. This will define the tokenization standards that we have to target. I'll be licensing the data, so you probably won't have direct access to it --- I'll have to do the actual training. It will probably be nice to give you a web API, so you can run things. If the API you call is emailing me "hey, train this model", well...That sucks.
- Define tokenization rules. This is mostly a list of prefix tokenization, a list of suffix tokenization, and a list of special-cases, which are exact-matched. The "How It Works" page says a little bit more about this, but not enough.
- Write a lemmatizer and morphological analyser. If there's a WordNet for the language you're targeting, and it's any good, I would prefer to lemmatize to WordNet sense-keys. The BabelNet project is probably the useful way to go about this.
Having written all this, I'm thinking it might be nice to inter-operate closely with Gensim on this. Gensim will give us the word2vec implementation, and would be a good way to handle the boot-strapping problem: if getting spaCy to work on a new language initially depends on processing a bunch of unannotated data with spaCy, then things are awkward.
I'll think more about this, and probably reach out to Radim about it.
When I was still using redshift, I used word2vec and gensim to generate word cluster with window_size=2. It was fast, but wasn't quite happy with the result until I found Percy Liang's word clustering tool. Took days to generate since I have large corpus.
If you need, I've a lot of resources for Portuguese (word2vec, Stanford NE Extractor, ConLL Floresta Sintática, POS Tagger (trigram, bigram, n-gram)...) that I've trained for my project.
@brunoalano thanks but actually I am interested in Turkish for the beginning.
Working on docs for this here: http://spacy.io/tutorials/add-a-language/
+1 Ideally we could develop the concept of explicit partial support of a new language. For example, tokenisation really works already for most languages.
I would be very interested in spaCy support for German, especially official support. Thanks for the documentation on adding languages!
See Issue #124
Select an unannotated corpus. This will probably be Wikipedia --- it's a nice way to streamline things across languages. Another nice solution would be to run a language identification program over Common Crawl dumps, so that we can get text from wider genres.
Perhaps the corpora from http://corporafromtheweb.org/ are useful here. They're large, come in several different languages (Dutch, English, French, German, Spanish, Swedish), and are tokenized pretty well. They're also POS-tagged and lemmatized, but I don't know whether that's needed here.
I'm pleased to say that there's now excellent support for German, thanks to the great work from our first NLP employee Wolfgang Seeker. We're still finishing up the blog post etc, but the model is uploaded and can be used from spaCy 0.100.7.
import spacy
de_nlp = spacy.load('de')
We're still refactoring and working on better processes for adding more languages. I'm going to close this issue because it's old and most of the information here is now out of date.
Obviously, there's still a lot to do to support more languages. And I think the idea of partial language support is important and overdue. But --- progress :)
I'm also glad to help in adding Portuguese tools to spaCy.
By the way, anyone knows if there is corpora to train dependency parsers or just PoS-taggers to Dutch?
Yes there are corpora for that: Lassy-Klein, Lassy-Groot, and SoNaR. Probably the best thing is to contact the TST-centrale. They are undergoing some changes in management, so they might be slow to respond.
For questions about Lassy, you can email Gertjan van Noord.
For questions about SoNaR you can email Nelleke Oostdijk.
I trained a POS-tagger on the NLCOW14 corpus, which was automatically tagged. But if you need something fast, then here is the repository.
If you just need a parser, try Alpino.
Thanks for your reply! One more questions, does the license associated to those datasets allows to be incorporated into spaCy or use it to process dutch text not within a research context?
I think if you're a researcher yourself, and you don't contribute to SpaCy for money I think it should be OK.
If you're a SpaCy employee it might technically be commercial use and the terms and conditions from the TST-centrale are different: I just checked and the license for Lassy-klein for commercial use costs 2000 euros. Same for SoNar-klein. The larger corpora cost more. Then again, SpaCy is open-source. So you can always try. If it doesn't work, contact Gertjan to see whether he can help you.
Else there's also this free smaller treebank on his website. That should at least get you started. And the people at the university of Groningen would probably be happy to see another parser for Dutch so they can compare Alpino to it :)
Also look around on Maarten van Gompel's GitHub here. He's worked on memory-based POS tagging for Dutch, among other things.
Dank u wel for all the clarifications!
You're welcome, but I just realized I forgot to mention http://universaldependencies.org/ which also covers Dutch, and seems to overlap with Lassy. Sorry!
I new here but have been trolling for a while, would be glad to add Bahasa support
@geovedi , were you working on Bahasa?