Skip to content
Snippets Groups Projects
Commit f9bb700c authored by Lukas Gehrke's avatar Lukas Gehrke
Browse files

Adds check for date as birthplace.

parent ccf459e7
No related branches found
No related tags found
1 merge request!52Resolve: "Refactor get_birthplace.R to get_nationality.R"
......@@ -13,7 +13,6 @@
#' @return String with birthplace of the physicist|NA
get_birthplace <- function(article, annotations) {
# If there is no infobox we return 0
if(grepl("vcard", article)) {
# Use infobox to get Birthplace
......@@ -31,7 +30,7 @@ get_birthplace <- function(article, annotations) {
} else {
# Try to extract birthplace from text as first NORP entitiy
# Not beautiful, because it mostly is Nationality of the physicist
# Not very effective, because it mostly is Nationality of the physicist
# - Get named entities
# - Get NORP entities
# - Get first NORP
......@@ -44,10 +43,11 @@ get_birthplace <- function(article, annotations) {
# Trim whitespaces
birthplace <- trimws(birthplace)
# Return birthplace or NA
if(!is.null(birthplace)) {
return(birthplace)
} else {
# Return NA if birthplace is a date or "0"
if(grep("\\d", birthplace) == 1) {
return(NA)
} else {
return(birthplace)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment