respace  1.0
Public Member Functions | List of all members
respacer Class Reference

#include <respacer.h>

Public Member Functions

 respacer (std::string const &dictionary_path, std::string const &language_model_path)
 
std::vector< std::string > respace (std::string const &letters)
 

Detailed Description

For a given string of letters and no spaces, returns the likeliest sequence of words.

For example, given "theappleisredandthebananaismushy", the likeliest sequence expected is "the apple is red and the banana is mushy".

Works by recursively using the given dictionary to find valid words at the head of the given string and then using the given language model to find the best scoring sequence of words.

Constructor & Destructor Documentation

respacer::respacer ( std::string const &  dictionary_path,
std::string const &  language_model_path 
)
inline
Parameters
dictionary_pathPath to a file containing list of words in alphabetical order, one word per line.
language_model_pathPath to a language model file for lm::ngram::Model to use.

Member Function Documentation

std::vector<std::string> respacer::respace ( std::string const &  letters)
inline

Given a string of characters with no spaces, computes the most likely original sentence.

Invokes companion function. This way, we have a clean signature.

Parameters
lettersA string of characters containing alphabetical characters exclusively.
Returns
A word sequence.

The documentation for this class was generated from the following file: