by kirillkh · 9y ago · 0 comments
You can also use Brown clustering [3] to create the clusters. It does a good job and is faster to compute than clustered word vectors. However clustered word vectors typically have better semantic performance.
1. https://www.slideshare.net/mobile/lucidworks/implementing-co...
2. Demo source: https://github.com/DiceTechJobs/ConceptualSearch
1) Do words in a generic corpus (such as Wikipedia) actually form well-separated clusters?
2) Is it correct that you find word clusters in the corpus as a preprocessing step (as opposed to at indexing or query time)?
3) Do I understand correctly that you use all words in clusters as synonyms and pass them to Solr at query/indexing time? Is it query time, index time or both?
4) Given a language where words have many syntactic forms (e.g. buy-bought-buying), how does it work with clusters? Do both syntactic forms and synonyms end up in the same cluster? Wouldn't it be beneficial to treat many of these different forms as the same word (i.e. perform stemming) and only list truly different, but closely related concepts as synonyms?
2. Correct. The goal of the pre-processing step is to generate a Solr synonyms file which can be added to your index mapping.
3a. You could use all the words, but in general I would advise against it. Using all the words from Wikipedia or Google News would be similar to using a thesaurus which can add a lot of noise. For example, the word "cocoa" could mean chocolate, a city in Florida, or programming language. It is better to use a list of domain-specific keywords and phrases as a filter for which words are added to the Solr synonyms file. However if your corpus is Wikipedia, Google News, or something equally generic, then using all the words makes sense.
3b. It must be both query and index time. For example, the phrase "java developer" would have the mapping "java developer => cluster_15" in the synonyms file. In order for the search terms "java developer" to match cluster_15, "cluster_15" must be indexed in place of "java developer".
4. The different forms will most likely end up in the same cluster, but stemming would guarantee it.
For example, in Hebrew the word BRHA can mean several things: "pool", "blessing", "in soft" and "her knee" (no kidding).
I did a talk on this with more details: https://www.slideshare.net/GarySieling/ai-with-the-best-buil...
Sense2Vec might also help: https://github.com/explosion/sense2vec
There is also a project called Vespa, which looks potentially interesting as a replacement for Lucene - https://github.com/vespa-engine/vespa
Thanks! I've written up something along these lines here: https://news.ycombinator.com/item?id=15592196
I'd love to hear your opinion if this is going to work.
from gensim.models.phrases import Phrases
bigrams = Phrases(corpus)
or you could rank bigrams by count(w1+w2)^2/(count(w1)*count(w2))many variations on this formula work, but the idea is to compare the count of the bigram to the counts of the unigrams.
By the way, you do bigram identification before Word2Vec to have specialized vectors for bigrams as well.
Besides this method, there is one great way to identify ngrams: use Wikipedia titles. It's quite an extended list that covers most of the important named entities, locations and multi-word topic names, or go directly to http://wiki.dbpedia.org/ for a huge list with millions of ngrams. Cross reference it with your text corpus and you get a nice clean list.
So if you insert them in the same order in a database, you can just use their primary key as weight for a word. This also has the advantage of filtering out stop words without any additional processing.
> works faster than grep
I didn't quite get the connection to grep.