public class Gazetteer extends Object
Since names often consist of several tokens, all name parameters are of type String[], with one array element for each token of a name.
| Constructor and Description |
|---|
Gazetteer()
create a new, empty Gazetteer.
|
| Modifier and Type | Method and Description |
|---|---|
String[] |
canonicalCountryName(String[] s)
if
s is the alias of a location name, returns the
primary location name, else null. |
String[] |
capitalToCountry(String[] s)
if
s is the name of the capital of a country, returns the
associated country name, else null. |
boolean |
isCountry(String[] s)
returns
true if s is the name of a country
(either the primary name or an alias). |
boolean |
isCountryAlias(String[] s)
returns
true if s is an alias of a
location name. |
boolean |
isLocation(String[] s)
returns
true if s is the name of any type of location
(either the primary name or an alias). |
boolean |
isNational(String[] s)
returns
true if s is the name of a national. |
boolean |
isNationality(String[] s)
returns
true if s is a nationality
adjective. |
boolean |
isNationals(String[] s)
returns
true if s is the name of a set of
nationals. |
boolean |
isRegionOrContinent(String[] s)
returns
true if s is the name of a region
or continent (either the primary name or an alias). |
boolean |
isState(String[] s)
returns
true if s is the name of a U.S. |
void |
load()
load the Gazetteer from the file specified by parameter
Gazetteer.fileName
of the configuration file. |
void |
load(String fileName)
load the Gazetteer from file
fileName. |
String |
locationType(Document doc,
String locationName)
returns "country", "stateorprovince", or "city" as the type
of 'locationName' based on three types of evidence:
- entries in the gazetteer itself
- a coreferential nominal mention, typically from a
construct 'city of X' or 'X province'
- the last token of the location name
|
static void |
main(String[] args) |
String[] |
nationalityToCountry(String[] s)
if
s is a nationality adjective, returns the
associated country name, else null. |
String[] |
nationalsToCountry(String[] s)
if
s is the name of a set of nationals, returns the
associated country name, else null. |
String[] |
nationalToCountry(String[] s)
if
s is the name of a national, returns the
associated country name, else null. |
void |
setMonocase(boolean monocase)
sets the
monocase which, when true, ignores case for
Gazetteer predicates. |
static String[] |
splitAtWS(String s) |
public void load()
throws IOException
Gazetteer.fileName
of the configuration file.IOExceptionpublic void load(String fileName) throws IOException
fileName.IOExceptionpublic void setMonocase(boolean monocase)
monocase which, when true, ignores case for
Gazetteer predicates.public boolean isNationality(String[] s)
true if s is a nationality
adjective.public String[] nationalityToCountry(String[] s)
s is a nationality adjective, returns the
associated country name, else null.public boolean isNational(String[] s)
true if s is the name of a national.public String[] nationalToCountry(String[] s)
s is the name of a national, returns the
associated country name, else null.public boolean isNationals(String[] s)
true if s is the name of a set of
nationals.public String[] nationalsToCountry(String[] s)
s is the name of a set of nationals, returns the
associated country name, else null.public String[] capitalToCountry(String[] s)
s is the name of the capital of a country, returns the
associated country name, else null.public boolean isLocation(String[] s)
true if s is the name of any type of location
(either the primary name or an alias).public boolean isCountry(String[] s)
true if s is the name of a country
(either the primary name or an alias).public boolean isCountryAlias(String[] s)
true if s is an alias of a
location name.public boolean isState(String[] s)
true if s is the name of a U.S.
state (either the primary name or an alias).public boolean isRegionOrContinent(String[] s)
true if s is the name of a region
or continent (either the primary name or an alias).public String[] canonicalCountryName(String[] s)
s is the alias of a location name, returns the
primary location name, else null.public static void main(String[] args) throws IOException
IOExceptionpublic String locationType(Document doc, String locationName)
Copyright © 2016 New York University. All rights reserved.