VIVO-125 Create more "Google Spanish" labels

Add more labels by changing the filter in the label_stripper/label_inserter scripts. Improve the structure of the scripts to use an external filter.
This commit is contained in:
j2blake 2013-06-21 14:58:28 -04:00
parent b758f374ad
commit c5acf46316
5 changed files with 589 additions and 423 deletions

View file

@ -11,6 +11,9 @@ require 'rdf/ntriples'
require 'rdf/n3'
include RDF
class UsageError < StandardError; end
class FilterError < StandardError; end
class LabelCommon
# ------------------------------------------------------------------------------------
@ -21,6 +24,13 @@ class LabelCommon
public
# ------------------------------------------------------------------------------------
def self.load_filter(filter_file)
return lambda{|s| true} unless filter_file
return eval(IO.read(filter_file))
rescue
raise FilterError.new($!.message)
end
def initialize(rdf_file, &filter)
@filter = filter.nil? ? lambda{true} : filter
@graph = Graph.load(rdf_file)