Meteor in C++: ============= The standalone meteor program (StandaloneMeteor.cpp) is a thorough example of using the Meteor library in C++ code. Unless fractions of a second are crucial, using the MeteorScorer wrapper is the best way to add Meteor scoring to your system with only a few lines of code. Note: If you use the Synonymy module, be sure to give the scorer the path to the synonymy directory (if not linked in current directory) The following is a basic example (example/demo.cpp): ================================================================================ #include #include "MeteorScorer.hpp" int main() { MeteorScorer ms("en", MeteorScorer::NORMALIZE_NO_PUNCT, true, "../wn"); MeteorTestSet ts; ts.addTest("this is a drop in shares drop on wall street"); ts.addRef("This time the fall in stocks on Wall Street is responsible for the drop."); ms.scoreSet(ts); std::cout << ts.getFinalScore() << "\n"; } ================================================================================ * See the MeteorScorer header file for descriptions of each function. * Remember to use the icu and boost link flags (see src/Jamfile for your system's flags) when linking programs that use the Meteor library (libmeteor.a). Meteor in Java: ============== The C++ classes required to run MeteorScorer are wrapped in Java classes and can be used in the same way with a few minor exceptions. The required files are installed to the java directory. The following is an example of using the Java wrapper: ================================================================================ public class demo { static { System.loadLibrary("MeteorWrapper"); } public static void main(String[] args) { // Cast normalization values to int for them to work with Java MeteorScorer ms = new MeteorScorer("en", (int) MeteorScorer.NORMALIZE_NO_PUNCT, true, "../wn"); MeteorTestSet ts = new MeteorTestSet(); ts.addTest("this is a drop in shares drop on wall street"); ts.addRef("This time the fall in stocks on Wall Street is responsible for the drop."); ms.scoreSet(ts); System.out.println(ts.getFinalScore()); } } ================================================================================ * Remember to include the location of libMeteorWrapper.so in your library path. ex: LD_LIBRARY_PATH=`pwd` java demo Meteor in Python: ================ The required classes to run MeteorScorer are wrapped in Python classes and included in the MeteorWrapper module. The required files are installed to the python directory. The following is an example of using the Python wrapper: ================================================================================ import MeteorWrapper ms = MeteorWrapper.MeteorScorer("en", MeteorWrapper.MeteorScorer.NORMALIZE_NO_PUNCT, True, "../wn") ts = MeteorWrapper.MeteorTestSet() ts.addTest("this is a drop in shares drop on wall street") ts.addRef("This time the fall in stocks on Wall Street is responsible for the drop.") ms.scoreSet(ts) print ts.getFinalScore() ================================================================================