public class LangModel extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
END_OF_STRING |
static String |
START_NEW_WORD |
static String |
START_OF_STRING |
| Constructor and Description |
|---|
LangModel(String lmFileName)
Load the language model.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isEndOfSentence(String character) |
boolean |
isMagicChar(String character) |
double |
predict_char_prob(int n)
Method which returns the probability of the nth most likley character at
the start of a sentence.
|
double |
predict_char_prob(String pre,
int n)
Method which returns the probability of the nth most likely character, given a
preceeding character (pre).
|
String |
predict_char(int n) |
String |
predict_char(String pre,
int n) |
double |
score(String str)
Convenience method for
score(String, boolean) with verbose flag set to false. |
double |
score(String str,
boolean verbose)
Splits a string into bigrams and calculates the language model score.
|
public static final String START_OF_STRING
public static final String END_OF_STRING
public static final String START_NEW_WORD
public LangModel(String lmFileName) throws IOException
lmFileName - path to a language model file.IOException - if the model file can't be found or read.public double score(String str, boolean verbose)
str - String for which to compute the scoreverbose - whether to print informationpublic double score(String str)
score(String, boolean) with verbose flag set to false.public String predict_char(String pre, int n)
public String predict_char(int n)
public double predict_char_prob(String pre, int n)
public double predict_char_prob(int n)
public boolean isMagicChar(String character)
public boolean isEndOfSentence(String character)
Copyright © 2010–2017 EvoSuite. All rights reserved.