java - tf*idf implementation? - java

I am basically creating a search engine and I want to implement tf*idf to rank my xml documents based on a search query. How do I implement it? How do I start it? Any help appreciated.

Surprising that the Weka library hasn't been mentioned here. Weka's StringToWordVector class implements TF-IDF.

I did this in the past, and I used Lucene to get the TD*IDF data.
It took fair amount of fiddling aound though, so if there are other solutions people know are easier, then use them.
Start by looking at TermFreqVector and other classes in org.apache.lucene.index.

tfidf is a standalone Java package that calculates Tf-Idf.

Apache Mahout:
https://github.com/apache/mahout/blob/master/mr/src/main/java/org/apache/mahout/vectorizer/TFIDF.java
I believe it requires a Hadoop File System, which is a bit of extra work. But it works great.

Related

integrate wordnet with solr7.5.0

I am beginner in solr7.5.0 and I don't know each and every modules of it. As I'm building question answer system I want to integrate wordnet so I can get better query responses. I googled it and found some methods and previous question but I'm really confused on how to do in solr version 7.5.0 step by step.
Edit: solr7.5.0 having WordnetSynonymParser class, So if anyone worked on same please guide me how I can use this class or is there another way to do it? and can I use python to do it?
thanks in advance.
This article is very useful for this question, and the integration of wordnet can be done by, there are WordNet prolog file('wn_s.pl') which has synsets, we can convert it to synonyms.txt which can be consumable by Solr. So, to convert wn_s.pl file we can use Syns2Syms.java. It generates Synonyms.txt which we can index to solr.
But WordNet expansion will only yield marginal gains in relevance if it is domain specific search, so simply creating your own synonyms list based on the common tokens in your index will give more relevance.

How to use word2vec?

I have to make lexical graph with words within a corpus. For that, I need to make a program with word2vec.
The thing is that I'm new at this. I've tried for 4 days now to find a way to use word2vec but I'm lost. My big problem is that I don't even know where to find the code in Java (I heard about deeplearning but I couldn't find the files on their website), how to integrate it in my project...
One of the easiest way to embody the Word2Vec representation in your java code is to use deeplearning4j, the one you have mentioned. I assume you have already seen the main pages of the project. For what concerns the code, check these links:
Github repository
Examples

Using Apache UIMA ConceptMapper in a "proof-of-concept mode"

I'm trying to use UIMA ConceptMapper to extract some key concepts and other interesting metadata from text documents. Due to the time constraints of the project and the fact that I'm not sure if UIMA ConceptMapper will work in this scenario, does anyone know of any quick way to create a basic program using ConceptMapper? That is, can I get away with a quick proof-of-concept without having to write:
Analysis engine descriptor
Different structures, interfaces, etc.
other various meta-stuff
just to see what it can annotate from a single document? Obviously, if it works on a proof-of-concept level, then the long-term plan is to have all those structures in place...
Have you tried the Ruta benchmark? It will let you quickly prototype with WORDTABLE and WORDLIST, similar to what ConceptMapper can do.

Intellij parsing java code

I want to use a math-expression parser of java code. In particular I would like to convert a math-expression given as String to an abstract syntax tree consisted of separate nodes.
Is there anyone to recommend me a relevant open source tool?
If no, how do you reckon the possibility to exploit Intellij source code to do this work?
Which classes are responsible for code parsing and analysis?
Are they included in idea.jar? How can I easily infiltrate their functionality (methods etc)?
I am speaking exclusively for Intellij.
Take a look at MVEL library.
If you only want the results of the math-expression you should revise the question and the answer i selected months ago:
Java 1.5: mathematical formula parser
Brieff description: use the java integration with dinamyc languajes like javascript to let them do the work for you
I would not use IntelliJ, as much as I love it.
If you need an AST, look no further than ANTLR. If you can write a grammar for your equations, ANTLR can generate a lexer/parser to create it for you.

Which is the best JSON rewriter for Java?

Which JSON rewriter is the best for applications written in Java? Criteria may vary. I'm personally most interested in stability and performance.
I am using the one from http://www.json.org. The direct link to the Java code is this:
http://www.json.org/java/index.html.
The nice thing about it is that it does not require any dependencies. You just need to add seven source files to your project and you've got yourself a JSON builder.
This one works just fine: http://json-lib.sourceforge.net/
This JsonTools library is very complete. You can find it at Berlios.

Categories