Frog
Public Member Functions | List of all members
NERTagger Class Reference

#include <ner_tagger_mod.h>

Inheritance diagram for NERTagger:
Inheritance graph
[legend]
Collaboration diagram for NERTagger:
Collaboration graph
[legend]

Public Member Functions

 NERTagger (TiCC::LogStream *, TiCC::LogStream *=0)
 
bool init (const TiCC::Configuration &)
 
void Classify (frog_data &)
 
void post_process (frog_data &)
 
void post_process (frog_data &, const std::vector< tc_pair > &)
 
void add_declaration (folia::Document &, folia::processor *) const
 
void add_result (const frog_data &fd, const std::vector< folia::Word * > &wv) const
 
bool read_gazets (const std::string &f, const std::string &p)
 
bool read_overrides (const std::string &f, const std::string &p)
 
std::vector< std::string > create_ner_list (const std::vector< std::string > &s)
 
std::vector< std::string > create_override_list (const std::vector< std::string > &s)
 
bool Generate (const std::string &)
 
void merge_override (std::vector< tc_pair > &, const std::vector< tc_pair > &, bool, const std::vector< std::string > &) const
 
- Public Member Functions inherited from BaseTagger
 BaseTagger (TiCC::LogStream *, TiCC::LogStream *, const std::string &)
 
virtual ~BaseTagger ()
 
void add_provenance (folia::Document &, folia::processor *) const
 
std::string getTagset () const
 
std::string set_eos_mark (const std::string &)
 
bool fill_map (const std::string &, std::map< std::string, std::string > &)
 
std::vector< Tagger::TagResult > tagLine (const std::string &)
 
std::vector< Tagger::TagResult > tag_entries (const std::vector< tag_entry > &)
 
std::string version () const
 

Additional Inherited Members

- Protected Member Functions inherited from BaseTagger
void extract_words_tags (const std::vector< folia::Word * > &, const std::string &, std::vector< std::string > &, std::vector< std::string > &)
 
std::vector< Tagger::TagResult > call_server (const std::vector< tag_entry > &) const
 
 BaseTagger (const BaseTagger &)
 
- Protected Attributes inherited from BaseTagger
int debug
 
std::string _label
 
std::string tagset
 
std::string _version
 
std::string textclass
 
TiCC::LogStream * err_log
 
TiCC::LogStream * dbg_log
 
std::string base
 
std::string _host
 
std::string _port
 
MbtAPI * tagger
 
TiCC::UniFilter * filter
 
std::vector< std::string > _words
 
std::vector< Tagger::TagResult > _tag_result
 
std::map< std::string, std::string > token_tag_map
 

Constructor & Destructor Documentation

◆ NERTagger()

NERTagger::NERTagger ( TiCC::LogStream *  l,
TiCC::LogStream *  d = 0 
)
explicit

initialize a NERTagger instance

Parameters
la LogStream for errors
da LogStream for debugging

Member Function Documentation

◆ add_declaration()

void NERTagger::add_declaration ( folia::Document &  doc,
folia::processor *  proc 
) const
virtual

add ENTITY annotation as an AnnotationType to the document

Parameters
docthe Document the add to
procthe processor to add

Implements BaseTagger.

◆ add_result()

void NERTagger::add_result ( const frog_data fd,
const std::vector< folia::Word * > &  wv 
) const

add the NER tags in 'fd' to the FoLiA list of Word

Parameters
fdThe tagged results
wvThe folia:Word vector

◆ Classify()

void NERTagger::Classify ( frog_data swords)
virtual

Tag one sentence, given in frog_data format

Parameters
swordsthe frog_data structure to analyze

When tagging succeeds, 'swords' will be extended with the tag results

Reimplemented from BaseTagger.

◆ create_ner_list()

std::vector<std::string> NERTagger::create_ner_list ( const std::vector< std::string > &  s)
inline

◆ create_override_list()

std::vector<std::string> NERTagger::create_override_list ( const std::vector< std::string > &  s)
inline

◆ Generate()

bool NERTagger::Generate ( const std::string &  opt_line)

generate a new tagger using opt_line

◆ init()

bool NERTagger::init ( const TiCC::Configuration &  config)
virtual

initalize a NER tagger from 'config'

Parameters
configthe TiCC::Configuration
Returns
true on succes, false otherwise

first BaseTagger::init() is called to set generic values, then the NER specific values for the gazeteer file-names etc. are added and the files are read.

Reimplemented from BaseTagger.

◆ merge_override()

void NERTagger::merge_override ( std::vector< tc_pair > &  tags,
const std::vector< tc_pair > &  overrides,
bool  unconditional,
const std::vector< std::string > &  POS_tags 
) const

merge overrides into the tc_pair vector

Parameters
tagsthe list of tc_pair to merge into
overridesthe override information (from gazeteers and such)
unconditionalwhen true, prefer the information from overrides, otherwise only override when there was no tag assigned yet
POS_tagsa list of POS-tags. When this list is non-empty, only override when it contains a N or a SPEC tag.

◆ post_process() [1/2]

void NERTagger::post_process ( frog_data )
virtual

This implements BaseTagger::post_process by DISALLOWING it.

Implements BaseTagger.

◆ post_process() [2/2]

void NERTagger::post_process ( frog_data sentence,
const std::vector< tc_pair > &  ners 
)

finish the NER processs by updating 'sentence'

Parameters
sentencea frog_data structure to update with NER info
nersa sequence of NE tags (maybe 'O') with their confidence

This is a specialized version local to NERTagger. Don't use the norma; post_process()

◆ read_gazets()

bool NERTagger::read_gazets ( const std::string &  f,
const std::string &  p 
)
inline

◆ read_overrides()

bool NERTagger::read_overrides ( const std::string &  f,
const std::string &  p 
)
inline

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