public class POSBaselineLearner
extends edu.illinois.cs.cogcomp.lbjava.learn.Learner
discrete
, i.e. that in the LBJ source file, a single
discrete
classifier is named in the learning classifier expression's
using
clause. That classifier is assumed to return the form of the word.
Note: This learner will not work if feature pre-extraction is enabled for it.
Modifier and Type | Class and Description |
---|---|
static class |
POSBaselineLearner.Parameters
Empty class, since there are no parameters
|
Modifier and Type | Field and Description |
---|---|
protected HashMap<String,TreeMap<String,Integer>> |
table
This map associates words with maps that associate POS tags with counts.
|
Constructor and Description |
---|
POSBaselineLearner()
Default constructor; sets the name to the empty string.
|
POSBaselineLearner(POSBaselineLearner.Parameters p)
Does nothing, as there are not parameters.
|
POSBaselineLearner(String n)
Constructor setting the name of the classifier.
|
Modifier and Type | Method and Description |
---|---|
Set<String> |
allowableTags(String form)
Returns the set of tags that the given word has been observed with.
|
edu.illinois.cs.cogcomp.lbjava.classify.FeatureVector |
classify(int[] exampleFeatures,
double[] exampleValues)
Dummy implementation of the abstract
learn(int[],double[],int[],double[])
signature for the compiler. |
edu.illinois.cs.cogcomp.lbjava.classify.FeatureVector |
classify(Object example)
This function makes one or more decisions about a single object, returning those decisions as
Feature s in a vector. |
protected String |
computePrediction(Object example)
Computes the prediction for this example.
|
String |
discreteValue(Object example)
Returns the value of the discrete prediction that this learner would make, given an example.
|
edu.illinois.cs.cogcomp.lbjava.learn.Learner |
emptyClone()
Returns a new, emtpy learner into which all of the parameters that control the behavior of
the algorithm have been copied.
|
edu.illinois.cs.cogcomp.lbjava.classify.Feature |
featureValue(Object example)
Returns the classification of the given example object as a single feature instead of a
FeatureVector . |
void |
forget()
Clears out the table to start fresh.
|
String |
getInputType()
Returns a string describing the input type of this classifier.
|
void |
learn(int[] exampleFeatures,
double[] exampleValues,
int[] exampleLabels,
double[] labelValues)
Dummy implementation of the abstract
learn(int[],double[],int[],double[])
signature for the compiler. |
void |
learn(Object example)
Trains the learning algorithm given an object as an example.
|
static boolean |
looksLikeNumber(String form)
Determines if the input word looks like a number of some sort.
|
boolean |
observed(String form)
Indicates whether the input word was observed while training this learner.
|
int |
observedCount(String form)
Returns the number of times the given form has been observed.
|
void |
read(ExceptionlessInputStream in)
Reads the binary representation of a learner with this object's run-time type, overwriting
any and all learned or manually specified parameters as well as the label lexicon but without
modifying the feature lexicon.
|
protected static void |
read(ExceptionlessInputStream in,
HashMap<String,TreeMap<String,Integer>> map)
Reads in the binary representation of the specific form of map used by this class.
|
edu.illinois.cs.cogcomp.lbjava.classify.ScoreSet |
scores(int[] features,
double[] values)
Returns
null . |
void |
write(ExceptionlessOutputStream out)
Writes the learned function's internal representation in binary form.
|
protected static void |
write(ExceptionlessOutputStream out,
HashMap<String,TreeMap<String,Integer>> map)
Writes the binary representation of the specific form of map used by this class.
|
void |
write(PrintStream out)
Writes the algorithm's internal representation as text.
|
static void |
write(PrintStream out,
HashMap<String,TreeMap<String,Integer>> table)
Writes the algorithm's internal representation as text.
|
classify, classify, classify, clone, countFeatures, createPrediction, createPrediction, demandLexicon, discreteValue, discreteValue, doneLearning, doneWithRound, featureValue, featureValue, getCurrentLexicon, getExampleArray, getExampleArray, getExtractor, getLabeler, getLabelLexicon, getLexicon, getLexiconDiscardCounts, getLexiconLocation, getModelLocation, getParameters, getPrunedLexiconSize, initialize, learn, learn, learn, read, readLabelLexicon, readLearner, readLearner, readLearner, readLearner, readLearner, readLearner, readLexicon, readLexicon, readLexiconOnDemand, readLexiconOnDemand, readModel, readModel, readParameters, realValue, realValue, realValue, save, saveLexicon, saveModel, scores, scores, scoresAugmented, setCandidates, setEncoding, setExtractor, setLabeler, setLabelLexicon, setLexicon, setLexiconLocation, setLexiconLocation, setLossFlag, setModelLocation, setModelLocation, setParameters, setReadLexiconOnDemand, unclone, unsetLossFlag, write, writeLexicon, writeModel, writeParameters
public POSBaselineLearner()
public POSBaselineLearner(String n)
n
- The name of the classifier.public POSBaselineLearner(POSBaselineLearner.Parameters p)
public edu.illinois.cs.cogcomp.lbjava.learn.Learner emptyClone()
emptyClone
in class edu.illinois.cs.cogcomp.lbjava.learn.Learner
public String getInputType()
getInputType
in class edu.illinois.cs.cogcomp.lbjava.classify.Classifier
"edu.illinois.cs.cogcomp.lbjava.nlp.Word"
public void learn(Object example)
learn
in class edu.illinois.cs.cogcomp.lbjava.learn.Learner
example
- An example of the desired learned classifier's behavior.public void learn(int[] exampleFeatures, double[] exampleValues, int[] exampleLabels, double[] labelValues)
learn(int[],double[],int[],double[])
signature for the compiler. Not to be used by the programmer.learn
in class edu.illinois.cs.cogcomp.lbjava.learn.Learner
exampleFeatures
- Not used.exampleValues
- Not used.exampleLabels
- Not used.labelValues
- Not used.public void forget()
forget
in class edu.illinois.cs.cogcomp.lbjava.learn.Learner
public static boolean looksLikeNumber(String form)
form
- The form of the word.true
iff the word contains only characters in ".,-" and at least one
digit.public String discreteValue(Object example)
discreteValue
in class edu.illinois.cs.cogcomp.lbjava.learn.Learner
example
- The example object.protected String computePrediction(Object example)
discreteValue(Object)
, featureValue(Object)
, and
classify(Object)
.example
- The example object.public edu.illinois.cs.cogcomp.lbjava.classify.Feature featureValue(Object example)
FeatureVector
.featureValue
in class edu.illinois.cs.cogcomp.lbjava.learn.Learner
example
- The object to classify.example
as a feature.public edu.illinois.cs.cogcomp.lbjava.classify.FeatureVector classify(Object example)
Feature
s in a vector.classify
in class edu.illinois.cs.cogcomp.lbjava.learn.Learner
example
- The object to make decisions about.Feature
s about the input object.public edu.illinois.cs.cogcomp.lbjava.classify.FeatureVector classify(int[] exampleFeatures, double[] exampleValues)
learn(int[],double[],int[],double[])
signature for the compiler. Not to be used by the programmer.classify
in class edu.illinois.cs.cogcomp.lbjava.learn.Learner
exampleFeatures
- Not used.exampleValues
- Not used.public edu.illinois.cs.cogcomp.lbjava.classify.ScoreSet scores(int[] features, double[] values)
null
.scores
in class edu.illinois.cs.cogcomp.lbjava.learn.Learner
public boolean observed(String form)
form
- The form of the word.true
if this learner contains statistics for the input word.public int observedCount(String form)
public Set<String> allowableTags(String form)
form
- The form of the word.public void write(PrintStream out)
write
in class edu.illinois.cs.cogcomp.lbjava.learn.Learner
out
- The output stream.public static void write(PrintStream out, HashMap<String,TreeMap<String,Integer>> table)
out
- The output stream.table
- The table.public void write(ExceptionlessOutputStream out)
write
in class edu.illinois.cs.cogcomp.lbjava.learn.Learner
out
- The output stream.protected static void write(ExceptionlessOutputStream out, HashMap<String,TreeMap<String,Integer>> map)
out
- The output stream.map
- The map to write.public void read(ExceptionlessInputStream in)
read
in class edu.illinois.cs.cogcomp.lbjava.learn.Learner
in
- The input stream.Copyright © 2017. All rights reserved.