NERsuite

A Named Entity Recognition toolkit

Command Reference

nersuite

Syntax

nersuite <mode> <-m model_filename> [-C C2_value] [-o output_format] [file(s)]

Parameters

  1. mode 
    - 'learn' or 'tag' 

  2. model_filename 
    - A model file name for storing a trained model in
     'train' mode, or for loading a model in 'tag' mode

  3. C2 value  (for learn mode) 
    - The C2 value of the CRFSuite Learning parameter 
    - Default value is 1.0 

  4. output_format  (for tag mode) 
    - 'conll' or 'standoff' format 
    - Default value is 'conll' format 

  5. input_file 
    - Input file(s) can be delivered in three ways.
      1. re-directed standard input.
      2. an input file name with -f option. (e.g. -f input.txt)
      3. a file of input file names with -l option. (e.g. -l list.txt)
        a file in the list file needs to have a relative path 
        from the directory in which the list file stored.
    - An input file consists of columns as follows.
        [1st col.] - the byte position of the first letter of a token. 
        [2nd col.] - the byte position one past the last letter of a token. 
        [3rd col.] - raw token (word)
        [4th col.] - lemma
        [5th col.] - POS tag
        [6th col.] - chunk tag
        [7th ... ] - any attributes
          P.s. With learn option, 1st column is a correct named entity label 
          for each line and other columns will be placed one column 
          after then the original position

Example

For learning:

    $ nersuite learn -m model.m < source.features_learn.txt

The following is a sample snippet of "source.features_learn.txt". As this is a training data, the correct labels are given in the first columns.

 This example does not have Dictionary Features.

...
B-GGP	0	1	5	5	CD	B-NP
I-GGP	1	2	-	-	HYPH	I-NP
I-GGP	2	5	LOX	LOX	NN	I-NP
O	6	9	and	and	CC	I-NP
B-GGP	10	11	5	5	CD	I-NP
I-GGP	11	12	-	-	HYPH	I-NP
I-GGP	12	15	LOX	LOX	NN	I-NP
O	16	26	activating	activate	VBG	B-VP
O	27	34	protein	protein	NN	B-NP
O	35	36	(	(	(	O
B-GGP	36	40	FLAP	FLAP	NN	B-NP
O	40	41	)	)	)	O
O	42	45	are	be	VBP	B-VP
...

Or, you can use a training data with Dictionary Features like:

...
B-GGP	0	1	5	5	CD	B-NP	O	O	B-EntrezGene_gene.syn	O	O	O	O	B-EntrezGene_prot.name	O	O	O	O	B-UMLS_Amino_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O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O
I-GGP	12	15	LOX	LOX	NN	I-NP	O	O	I-EntrezGene_gene.syn	O	O	O	O	I-EntrezGene_prot.name	O	O	O	O	I-UMLS_Amino_Acid,_Peptide,_or_Protein	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	I-UMLS_Enzyme	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O
O	16	26	activating	activate	VBG	B-VP	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O
O	27	34	protein	protein	NN	B-NP	B-EntrezGene_gene.desc	O	B-EntrezGene_gene.syn	O	O	O	B-EntrezGene_prot.desc	B-EntrezGene_prot.name	O	O	O	O	B-UMLS_Amino_Acid,_Peptide,_or_Protein	O	O	O	O	O	O	O	O	O	O	B-UMLS_Biologically_Active_Substance	O	O	O	O	O	O	O	O	O	O	O	B-UMLS_Cell_Component	O	O	O	O	O	O	O	O	B-UMLS_Conceptual_Entity	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	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	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O
O	42	45	are	be	VBP	B-VP	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O	O
...

For Tagging:

     $ nersuite tag -m model.m < source.features.txt > result.features.txt
                        

The following is a sample snippet of "source.features.txt". (Only shows an example without Dictionary Features.)

...
0	2	DG	DG	NNS	B-NP
3	6	and	and	CC	I-NP
7	9	GG	GG	NNS	I-NP
10	14	were	be	VBD	B-VP
15	26	synthesized	synthesize	VBN	I-VP
27	32	using	use	VBG	B-VP
33	34	3	3	CD	B-NP
34	35	-	-	HYPH	I-NP
35	53	methylcholanthrene	methylcholanthrene	NN	I-NP
53	54	-	-	HYPH	B-NP
54	61	induced	induce	VBN	I-NP
62	65	rat	rat	NN	I-NP
66	71	liver	liver	NN	I-NP
72	82	microsomes	microsome	NNS	I-NP
82	83	.	.	.	O
...

Please make sure that each line of input data is always terminated with LF (not CR LF) in a Linux environment.

nersuite_tokenizer

Syntax

nersuite_tokenizer < input_file > output_file

Parameters


                        

Example

    $ nersuite_tokenizer < source.txt > source.tokenized.txt
                        

"source.txt" should be in the format like the following example:

...
DG and GG were synthesized using 3-methylcholanthrene-induced rat liver microsomes.
...

nersuite_gtagger

Syntax

nersuite_gtagger -d <path_to_the_model_directory> [file(s)]

Parameters

  1. path_to_the_model_directory
    - Path to the directory in which the GENIA tagger models are stored 
  2. [file(s)]
    - Input file(s) can be delivered in three ways.
      1. re-directed standard input.
      2. an input file name with -f option. (e.g. -f input.txt)
      3. a file of input file names with -l option. (e.g. -l list.txt)
        a file in the list file needs to have a relative path from the directory in which the list file stored.
    - A file consists of a beginning position, a past-the-end position and a token columns.
    - Each column is tab-separated.

Example

    $ nersuite_gtagger -d gtagger_models < source.tokenized.txt > source.features.txt
                        

"source.tokenized.txt" should be in the format like the following example:

...
0	2	DG
3	6	and
7	9	GG
10	14	were
15	26	synthesized
27	32	using
33	34	3
34	35	-
35	53	methylcholanthrene
53	54	-
54	61	induced
62	65	rat
66	71	liver
72	82	microsomes
82	83	.
...

nersuite_dic_compiler

Syntax

nersuite_dic_compiler [options] <Text_dictionary_filename> <CDB++_DB_filename>

Parameters

  Text dictionary should be a text file containing dictionary entries,
  one per line with the following tab-separated format:
    Named_Entity <tab> Class1 <tab> Class2 <tab> Class3 ...
  Options:
    -n <type_of_normalization> : Normalization type for dictionary matching
       can be "none" or any combination of "c", "n", "s", "t"
       none (default): No normalization
       c: Case insensitive (convert all letters to lowercase)
       cn: Case AND Number insensitive (convert all numbers to '0')
       cns: Case AND Number AND Symbol insensitive (convert all symbols to '_')
       t: Use token-base matching

Example

     $ nersuite_dic_compiler -n cns dictionary.txt dictionary.cdbpp
                        

"dictionary.txt" should be in the format like the following example (the column after a tab assigns a class to the word):

...
hydroxyacyl-Coenzyme A dehydrogenase<tab>EntrezGene
hydroxyacyl-Coenzyme A dehydrogenase pseudogene<tab>EntrezGene
...

nersuite_dic_tagger/h3>

Syntax

nersuite_dic_tagger [options] CDB++_DB_filename < standard input

Parameters

    Options:
    -n <type_of_normalization> : Normalization type for dictionary matching
       none (default): No normalization
       can be "none" or any combination of "c", "n", "s", "t"
       c: Case insensitive (convert all letters to lowercase)
       cn: Case AND Number insensitive (convert all numbers to '0')
       cns: Case AND Number AND Symbol insensitive (convert all symbols to '_')
       t: Use token-base matching

    Line format of the input file: 
         [1st col.] - the byte position of the first letter of a token. 
         [2nd col.] - the byte position one past the last letter of a token. 
         [3rd col.] - raw token
         [4th col.] - lemma
         [5th col.] - POS tag
         [6th col.] - chunk tag
         [7th ... ] - any attributes

Example

    $ nersuite_dic_tagger -n cns dictionary.db < source.features.txt > result.features.txt
                        

"source.features.txt" should be in the format like the following example:

...
0	2	DG	DG	NNS	B-NP
3	6	and	and	CC	I-NP
7	9	GG	GG	NNS	I-NP
10	14	were	be	VBD	B-VP
15	26	synthesized	synthesize	VBN	I-VP
27	32	using	use	VBG	B-VP
33	34	3	3	CD	B-NP
34	35	-	-	HYPH	I-NP
35	53	methylcholanthrene	methylcholanthrene	NN	I-NP
53	54	-	-	HYPH	B-NP
54	61	induced	induce	VBN	I-NP
62	65	rat	rat	NN	I-NP
66	71	liver	liver	NN	I-NP
72	82	microsomes	microsome	NNS	I-NP
82	83	.	.	.	O
...