diff --git a/Dockerfile b/Dockerfile index 9d7cb73..b26ecc3 100755 --- a/Dockerfile +++ b/Dockerfile @@ -32,16 +32,16 @@ disable_system_repos=0\n'\ # Clean all yum cache RUN yum update -y && \ yum install -y yum-utils && \ - yum install -y which java-1.8.0-openjdk java-1.8.0-openjdk-devel unzip && \ + yum install -y which java-17-openjdk java-17-openjdk-devel unzip && \ curl -fsSL https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar xzf - -C /usr/share && \ mv /usr/share/apache-maven-$MAVEN_VERSION /usr/share/maven && \ ln -s /usr/share/maven/bin/mvn /usr/bin/mvn && \ yum install -y gcc git python39 python39-devel && \ alternatives --set python /usr/bin/python3.9 && \ pip3 install --upgrade pip && \ - curl -LO https://archive.apache.org/dist/activemq/activemq-artemis/2.19.1/apache-artemis-2.19.1-bin.zip && \ - unzip apache-artemis-2.19.1-bin.zip && \ - apache-artemis-2.19.1/bin/artemis create mybroker --user deepphe --password deepphe --allow-anonymous && \ + curl -LO https://archive.apache.org/dist/activemq/activemq-artemis/2.36.0/apache-artemis-2.36.0-bin.zip && \ + unzip apache-artemis-2.36.0-bin.zip && \ + apache-artemis-2.36.0/bin/artemis create mybroker --user deepphe --password deepphe --allow-anonymous && \ yum clean all # Set environment variables for Java and Maven @@ -61,7 +61,7 @@ RUN mvn -U clean package # Execute the parser jar CMD ["java", "-cp", \ -"instance-generator/target/instance-generator-5.0.0-SNAPSHOT-jar-with-dependencies.jar", \ +"instance-generator/target/instance-generator-7.0.0-SNAPSHOT-jar-with-dependencies.jar", \ "org.apache.ctakes.core.pipeline.PiperFileRunner", \ "-p", "org/apache/ctakes/timelines/pipeline/Timelines", \ "-i", "/usr/src/app/input", \ diff --git a/README.md b/README.md index 21e77ac..a81931b 100755 --- a/README.md +++ b/README.md @@ -83,14 +83,14 @@ Due to a current issue in the inter process communication, the process will fini ## Running the system outside of a Docker image This is for the most part actually how we have ran the system during development, and can be resorted to in the event of issues with creating or running a Docker image. Use the following steps for setup: -- Make sure you have Java JDK 8 (we use OpenJDK) and the latest version of maven installed and that Java 8 is set as your default system Java +- Make sure you have Java JDK 11 (we use OpenJDK) and the latest version of maven installed and that Java 11 is set as your default system Java - Create a conda 3.9 environment with `conda create -n timelines python=3.9` - Change directory into `timelines` under the project root - Create an ActiveMQ broker named `mybroker` in your current directory via: ``` -curl -LO https://archive.apache.org/dist/activemq/activemq-artemis/2.19.1/apache-artemis-2.19.1-bin.zip && \ -unzip apache-artemis-2.19.1-bin.zip && \ -apache-artemis-2.19.1/bin/artemis create mybroker --user deepphe --password deepphe --allow-anonymous +curl -LO https://archive.apache.org/dist/activemq/activemq-artemis/2.32.0/apache-artemis-2.32.0-bin.zip && \ +unzip apache-artemis-2.32.0-bin.zip && \ +apache-artemis-2.32.0/bin/artemis create mybroker --user deepphe --password deepphe --allow-anonymous ``` - (temporary fix until we fix the PBJ and timelines dependencies issue) Install the system's Python dependencies via: ``` diff --git a/timelines/gold_debug_just_run.sh b/timelines/gold_debug_just_run.sh index dcfd72f..312f6e8 100755 --- a/timelines/gold_debug_just_run.sh +++ b/timelines/gold_debug_just_run.sh @@ -1,9 +1,9 @@ -java -cp instance-generator/target/instance-generator-5.0.0-SNAPSHOT-jar-with-dependencies.jar \ +java -cp instance-generator/target/instance-generator-7.0.0-SNAPSHOT-jar-with-dependencies.jar \ org.apache.ctakes.core.pipeline.PiperFileRunner \ -p org/apache/ctakes/timelines/pipeline/Timelines \ - -a mybroker \ - -v /usr/local/miniconda3/envs/timelines-docker \ - -i ../input/ \ - -o ../output \ + -a C:\Users\ch229935\Documents\apache-artemis-2.39.0-bin\mybroker \ + -v C:\Users\ch229935\.conda\envs\ctakes-chemotime \ + -i C:\Users\ch229935\Desktop\cTakes\chemoTimelinesBaselineSystem\input\breast_dev_restrictions\ \ + -o . \ -l org/apache/ctakes/dictionary/lookup/fast/bsv/Unified_Gold_Dev.xml \ --pipPbj yes \ diff --git a/timelines/instance-generator/pom.xml b/timelines/instance-generator/pom.xml index 6945e94..09aaac3 100755 --- a/timelines/instance-generator/pom.xml +++ b/timelines/instance-generator/pom.xml @@ -5,7 +5,7 @@ txtimelines-lookup org.healthnlp - 5.0.0-SNAPSHOT + 7.0.0-SNAPSHOT 4.0.0 @@ -13,9 +13,9 @@ jar - 8 - 8 - 5.0.0-SNAPSHOT + 17 + 17 + 7.0.0-SNAPSHOT false @@ -25,6 +25,16 @@ ${ctakes.version} + + org.apache.ctakes + ctakes-examples + ${ctakes.version} + + + org.apache.ctakes + ctakes-user-resources + ${ctakes.version} + com.google.guava guava @@ -65,11 +75,11 @@ ${ctakes.version} - - org.healthnlp - tweaked-timenorm - ${project.parent.version} - + + + + + diff --git a/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/ae/AnnotationConfidencer.java b/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/ae/AnnotationConfidencer.java deleted file mode 100755 index d121746..0000000 --- a/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/ae/AnnotationConfidencer.java +++ /dev/null @@ -1,123 +0,0 @@ -package org.apache.ctakes.temporal.ae; - -import org.apache.ctakes.core.pipeline.PipeBitInfo; -import org.apache.ctakes.typesystem.type.syntax.BaseToken; -import org.apache.ctakes.typesystem.type.textsem.EventMention; -import org.apache.log4j.Logger; -import org.apache.uima.analysis_engine.AnalysisEngineProcessException; -import org.apache.uima.fit.component.JCasAnnotator_ImplBase; -import org.apache.uima.fit.util.JCasUtil; -import org.apache.uima.jcas.JCas; - -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.IntSummaryStatistics; - -/** - * @author SPF , chip-nlp - * @since {1/12/2024} - */ -@PipeBitInfo( - name = "AnnotationConfidencer", - description = "Does something.", - role = PipeBitInfo.Role.ANNOTATOR -) -public class AnnotationConfidencer extends JCasAnnotator_ImplBase { - - static private final Logger LOGGER = Logger.getLogger("AnnotationConfidencer"); - - // See RareWordUtil for examples of these parts of speech. Maybe less with JJ, JJR, JJS ? - static private final Collection BAD_POS = new HashSet<>( Arrays.asList( - "CC", "DT", "EX", "IN", "MD", "PDT", "PP$", "PPZ", "PRP", "PRP$", "TO", "WDT", "WP", "WP$", "WRB" - ) ); - - /** - * {@inheritDoc} - */ - @Override - public void process(final JCas jcas) throws AnalysisEngineProcessException { - LOGGER.info( "Setting annotation confidence scores ..." ); - JCasUtil.indexCovered( jcas, EventMention.class, BaseToken.class ) - .forEach( AnnotationConfidencer::setConfidence ); - } - - static private void setConfidence( final EventMention mention, final Collection tokens ) { - final long posDeficit = getPosDeficit( tokens ); - final long lengthDeficit = getTokenLengthDeficit( tokens ); -// final long caseDeficit = getCaseDeficit( tokens ); - final float score = Math.max( 1, 100 - posDeficit - lengthDeficit ) / 100f; - mention.setConfidence( score ); - } - - /** - * @param tokens - - * @return 20 if the term is only one word and is of a part of speech that shouldn't represent a term. - */ - static private long getPosDeficit( final Collection tokens ) { - if ( tokens.size() > 1 ) { - return 0; - } - return tokens.stream() - .map( BaseToken::getPartOfSpeech ) - .anyMatch( BAD_POS::contains ) ? 20 : 0; - } - - /** - * - * @param tokens - - * @return deficit based upon: total length of the term (non-whitespace), length of max token, number of tokens. - */ - static private long getTokenLengthDeficit( final Collection tokens ) { - if ( tokens.size() >= 3 ) { - return 0; - } - final IntSummaryStatistics stats = tokens.stream() - .map( BaseToken::getCoveredText ) - .mapToInt( String::length ) - .summaryStatistics(); - // term length deficit: 3 = 15, 4 = 10, 5 = 5 = 5 * (6-length) - final long termLengthDeficit = Math.max( 0, 5*(7-stats.getSum()) ); - // token length deficit: 3 = 10, 4 = 5 = 5 * (5-length) - final long tokenLengthDeficit = Math.max( 0, 5*(5-stats.getMax()) ); - // count deficit: 1 = 2, 2 = 1 = 3-count - final long tokenCountDeficit = Math.max( 0, 3-tokens.size() ); - return (termLengthDeficit + tokenLengthDeficit) * tokenCountDeficit; - } - - /** - * dPhe has a method that compares the covered text to the actual dictionary entry text. This AE can't do that. - * @param tokens - - * @return - - */ - static private long getCaseDeficit( final Collection tokens ) { - if ( tokens.size() > 1 ) { - return 0; - } - return tokens.stream() - .map( BaseToken::getCoveredText ) - .map( AnnotationConfidencer::getCaseDeficit ) - .findFirst() - .orElse(0L ); - } - - - /** - * dPhe has a method that compares the covered text to the actual dictionary entry text. This AE can't do that. - * @param token - - * @return - - */ - static private long getCaseDeficit( final String token ) { - if ( token.length() > 7 ) { - return 0; - } - // If a token length > 3 start with 2nd char, force match the first char in case of capitalization. - int start = token.length() > 3 ? 1 : 0; - // The shorter the token length the greater the penalty. - long penalty = 7 - Math.min( 6, token.length() ); - final long lowerCount = Math.max( 0, token.chars().filter( Character::isLowerCase ).count() - start ); - return penalty * lowerCount; - } - - -} diff --git a/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/ae/DCTAnnotator.java b/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/ae/DCTAnnotator.java index 4a63ca8..3acea43 100755 --- a/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/ae/DCTAnnotator.java +++ b/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/ae/DCTAnnotator.java @@ -5,7 +5,8 @@ import org.apache.ctakes.core.util.doc.SourceMetadataUtil; import org.apache.ctakes.typesystem.type.structured.DocumentPath; import org.apache.ctakes.typesystem.type.structured.SourceData; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.uima.UimaContext; import org.apache.uima.analysis_engine.AnalysisEngineProcessException; import org.apache.uima.fit.util.JCasUtil; @@ -21,7 +22,7 @@ ) public class DCTAnnotator extends org.apache.uima.fit.component.JCasAnnotator_ImplBase { - final static private Logger LOGGER = Logger.getLogger( "DCTAnnotator" ); + final static private Logger LOGGER = LoggerFactory.getLogger( "DCTAnnotator" ); final static private DocTimeApproximator _approximator = new DocTimeApproximator(); @Override public void initialize( UimaContext context ) throws ResourceInitializationException { @@ -41,7 +42,7 @@ public void process( JCas jCas ) throws AnalysisEngineProcessException { if ( fileNameElements.length >= 3 ){ String[] possibleDate = - fileNameElements[2].split("-"); + fileNameElements[2].split("-"); if ( possibleDate.length == 3 ){ diff --git a/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/ae/EventFilter.java b/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/ae/EventFilter.java deleted file mode 100755 index c0f82e7..0000000 --- a/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/ae/EventFilter.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.apache.ctakes.temporal.ae; - -import org.apache.ctakes.core.pipeline.PipeBitInfo; -import org.apache.ctakes.core.resource.FileLocator; -import org.apache.ctakes.typesystem.type.constants.CONST; -import org.apache.ctakes.typesystem.type.textsem.EventMention; -import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation; -import org.apache.log4j.Logger; -import org.apache.uima.UimaContext; -import org.apache.uima.analysis_engine.AnalysisEngineProcessException; -import org.apache.uima.fit.descriptor.ConfigurationParameter; -import org.apache.uima.fit.util.JCasUtil; -import org.apache.uima.jcas.JCas; -import org.apache.uima.resource.ResourceInitializationException; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; -import java.util.HashSet; -import java.util.Optional; -import java.util.Set; -import java.util.Collection; -import java.util.stream.Collectors; - -@PipeBitInfo( - name = "EventFilter ( TxTimelines )", - description = " Filters event mentions which contain any of the provided set of terms ( to be called after EventAnnotator ) ", - dependencies = { PipeBitInfo.TypeProduct.EVENT }, - products = { PipeBitInfo.TypeProduct.EVENT } -) - -public class EventFilter extends org.apache.uima.fit.component.JCasAnnotator_ImplBase { - final static private Logger LOGGER = Logger.getLogger( "EventFilter" ); - - public static final String PARAM_FILTER_LIST = "filterList"; - - @ConfigurationParameter( - name = PARAM_FILTER_LIST, - description = "Path to the newline separated file of terms to filter out", - mandatory = false - ) - private String filterList; - - private Set terms; - - @Override - public void initialize( UimaContext context ) throws ResourceInitializationException { - super.initialize( context ); - this.terms = getTerms(); - } - - @Override - public void process( JCas jCas ) throws AnalysisEngineProcessException { - try { - Collection removals = JCasUtil.select( jCas, EventMention.class ) - .stream() - // TODO filter by meds / TUI T121 - // or actually is it TUI T061 ? - .filter( this::toRemove ) - .collect( Collectors.toList() ); - - removals.forEach( EventMention::removeFromIndexes ); - } catch ( Exception e ){ - throw new AnalysisEngineProcessException(e); - } - } - - private boolean toRemove( EventMention eventMention ){ - - // for preserving my own sanity - // https://winterbe.com/posts/2015/03/15/avoid-null-checks-in-java/ - - /* - String contextualModality = Optional.of( eventMention ) - .map( EventMention::getEvent ) - .map( Event::getProperties ) - .map( EventProperties::getContextualModality ) - .orElse( "" ) - .trim() - .toLowerCase(); - - boolean isHypothetical = contextualModality.equals( "hypothetical" ) || contextualModality.equals( "hedged" ) || contextualModality.equals( "generic" ); - */ - - - - // int certainty = Optional.of( eventMention ) - // .map( IdentifiedAnnotation::getUncertainty ) - // .orElse( CONST.NE_UNCERTAINTY_ABSENT ); - - // boolean isUncertain = certainty == CONST.NE_UNCERTAINTY_PRESENT; - - // this is very very brute force, it behooves us to check - // how the dictionary lookup works since there are ways for even - // fuzzy matching to be more efficient than this but for - // low demand and small exclusion lists it's not _too_ much of a trade off - boolean isFilterMatch = false; - if ( !this.terms.isEmpty() ) { - isFilterMatch = this.terms.stream() - .anyMatch( - term -> eventMention - .getCoveredText() - .trim() - .toLowerCase() - // .contains(term) - .equals( term ) - ); - } - return isFilterMatch; // || isUncertain; //isHypothetical; - } - - private Set getTerms() { - if ( filterList != null && !filterList.isEmpty() ) { - try ( InputStream descriptorStream = FileLocator.getAsStream( filterList ) ) { - return new BufferedReader( - new InputStreamReader( - descriptorStream, - StandardCharsets.UTF_8 - ) - ).lines() - .map( String::toLowerCase ) - .map( String::trim ) - .collect( Collectors.toSet() ); - } catch ( IOException e ) { - throw new RuntimeException( e ); - } - } else { - //throw new RuntimeException( "Missing Filter List" ); - LOGGER.info( "Missing Filter List, Using Empty List" ); - return new HashSet<>(); - } - } -} diff --git a/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/ae/SegmentsFromBracketedSectionTagsAnnotator.java b/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/ae/SegmentsFromBracketedSectionTagsAnnotator.java deleted file mode 100755 index bd49d4e..0000000 --- a/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/ae/SegmentsFromBracketedSectionTagsAnnotator.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.apache.ctakes.temporal.ae; - -import org.apache.uima.analysis_engine.AnalysisEngineProcessException; -import org.apache.uima.fit.component.JCasAnnotator_ImplBase; -import org.apache.uima.jcas.JCas; -import org.apache.ctakes.typesystem.type.textspan.Segment; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -// from Sean or Tim originally, I think it's still actually in ctakes temporal somewhere but idk -public class SegmentsFromBracketedSectionTagsAnnotator extends JCasAnnotator_ImplBase { - private static Pattern SECTION_PATTERN = Pattern.compile( - "(\\[start section id=\"?(.*?)\"?\\]).*?(\\[end section id=\"?(.*?)\"?\\])", - Pattern.DOTALL ); - - @Override - public void process( JCas jCas ) throws AnalysisEngineProcessException { - boolean foundSections = false; - Matcher matcher = SECTION_PATTERN.matcher( jCas.getDocumentText() ); - while ( matcher.find() ) { - Segment segment = new Segment( jCas ); - segment.setBegin( matcher.start() + matcher.group( 1 ).length() ); - segment.setEnd( matcher.end() - matcher.group( 3 ).length() ); - segment.setId( matcher.group( 2 ) ); - segment.addToIndexes(); - foundSections = true; - } - if ( !foundSections ) { - Segment segment = new Segment( jCas ); - segment.setBegin( 0 ); - segment.setEnd( jCas.getDocumentText().length() ); - segment.setId( "SIMPLE_SEGMENT" ); - segment.addToIndexes(); - } - } -} diff --git a/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/ae/TimeMentionNormalizer.java b/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/ae/TimeMentionNormalizer.java deleted file mode 100755 index 778d80a..0000000 --- a/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/ae/TimeMentionNormalizer.java +++ /dev/null @@ -1,229 +0,0 @@ -package org.apache.ctakes.temporal.ae; - -import org.apache.commons.io.FilenameUtils; -import org.apache.ctakes.core.cc.AbstractJCasFileWriter; -import org.apache.ctakes.core.pipeline.PipeBitInfo; -import org.apache.ctakes.core.util.annotation.IdentifiedAnnotationUtil; -import org.apache.ctakes.core.util.annotation.OntologyConceptUtil; -import org.apache.ctakes.core.util.doc.SourceMetadataUtil; -import org.apache.ctakes.typesystem.type.constants.CONST; -import org.apache.ctakes.typesystem.type.refsem.Event; -import org.apache.ctakes.typesystem.type.refsem.EventProperties; -import org.apache.ctakes.typesystem.type.refsem.UmlsConcept; -import org.apache.ctakes.typesystem.type.structured.SourceData; -import org.apache.ctakes.typesystem.type.structured.DocumentPath; -import org.apache.ctakes.typesystem.type.textsem.EventMention; -import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation; -import org.apache.ctakes.typesystem.type.textsem.MedicationMention; -import org.apache.ctakes.typesystem.type.textsem.TimeMention; -// import org.apache.ctakes.typesystem.type.refsem.Date; -import org.apache.ctakes.typesystem.type.refsem.Time; -import org.apache.ctakes.typesystem.type.structured.SourceData; -import org.apache.log4j.Logger; -import org.apache.uima.fit.descriptor.ConfigurationParameter; -import org.apache.uima.fit.util.JCasUtil; -import org.apache.uima.jcas.JCas; -import org.clulab.timenorm.scfg.Temporal; -import org.clulab.timenorm.scfg.TemporalExpressionParser; -import org.clulab.timenorm.scfg.TimeSpan; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.apache.uima.analysis_engine.AnalysisEngineProcessException; -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import me.tongfei.progressbar.*; -import com.google.common.util.concurrent.TimeLimiter; -import com.google.common.util.concurrent.SimpleTimeLimiter; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import org.apache.uima.UimaContext; -import org.apache.uima.analysis_engine.AnalysisEngineProcessException; -import org.apache.uima.fit.descriptor.ConfigurationParameter; -import org.apache.uima.fit.util.JCasUtil; -import org.apache.uima.jcas.JCas; -import org.apache.uima.resource.ResourceInitializationException; -@PipeBitInfo( - name = "TimeMentionNormalizer", - description = "Normalizes time expressions", - dependencies = { PipeBitInfo.TypeProduct.EVENT, PipeBitInfo.TypeProduct.TIMEX } -) - - -public class TimeMentionNormalizer extends org.apache.uima.fit.component.JCasAnnotator_ImplBase { - static private final Logger LOGGER = Logger.getLogger( "TimeMentionNormalizer" ); - - public static final String PARAM_TUIS = "tuis"; - - @ConfigurationParameter( - name = PARAM_TUIS, - description = "If an event has one of these TUIs it will be kept, otherwise removed", - defaultValue = "T061", - mandatory = false - ) - private String tuis; - - public static final String PARAM_TIMEOUT = "timeout"; - public static final int DEFAULT_TIMEOUT = 5; - @ConfigurationParameter( - name = PARAM_TIMEOUT, - description = "How long to wait before canceling the operation for normalizing a time mention", - mandatory = false - ) - private int timeout = DEFAULT_TIMEOUT; - private Set tuiSet; - - static private final TemporalExpressionParser normalizer = TemporalExpressionParser.en(); - static private final TimeLimiter timeLimiter = SimpleTimeLimiter.create(Executors.newSingleThreadExecutor()); - - @Override - public void initialize( UimaContext context ) throws ResourceInitializationException { - super.initialize( context ); - this.tuiSet = new HashSet(); - final String[] tuiArr = tuis.split( "," ); - for ( String tui : tuiArr ) { - this.tuiSet.add( tui.toUpperCase() ); - } - - final Object _timeout = context.getConfigParameterValue( PARAM_TIMEOUT ); - if ( _timeout != null ) { - this.timeout = parseInt( _timeout, PARAM_TIMEOUT, this.timeout ); - } - LOGGER.info( "Using timeout: " + this.timeout ); - } - - @Override - public void process( JCas jCas ) throws AnalysisEngineProcessException { - final SourceData sourceData = SourceMetadataUtil.getOrCreateSourceData( jCas ); - final String docTime = sourceData.getSourceOriginalDate(); - DocumentPath documentPath = JCasUtil.select( jCas, DocumentPath.class ).iterator().next(); - final String fileName = FilenameUtils.getBaseName( documentPath.getDocumentPath() ); - // if (this.tuis != null && !this.tuis.trim().isEmpty()){ - // boolean hasRelevantTUIs = JCasUtil - // .select( jCas, EventMention.class ) - // .stream() - // .map( OntologyConceptUtil::getUmlsConcepts ) - // .flatMap( Collection::stream ) - // .map( UmlsConcept::getTui ) - // .anyMatch( tui -> this.tuiSet.contains( tui ) ); - - // if ( !hasRelevantTUIs ){ - // LOGGER.info(fileName + " : no events with the provided TUIs " + this.tuis + " skipping to save time"); - // return; - // } - // } - - TimeSpan _DCT = null; - if ( docTime == null || docTime.isEmpty() ){ - LOGGER.warn( fileName + ": Empty Document Creation Time" ); - } else { - String[] docTimeComponents = docTime.split("-"); - // DCTAnnotator generated ( should be this in all cases ) - if (docTimeComponents.length == 3) { - _DCT = TimeSpan.of( - Integer.parseInt(docTimeComponents[0]), - Integer.parseInt(docTimeComponents[1]), - Integer.parseInt(docTimeComponents[2])); - } else { - // DocTimeApproximator generated - _DCT = TimeSpan.of( - Integer.parseInt(docTime.substring(0, 4)), - Integer.parseInt(docTime.substring(4, 6)), - Integer.parseInt(docTime.substring(6, 8))); - } - } - final TimeSpan DCT = _DCT; - List timeMentions = JCasUtil - .select( jCas, TimeMention.class ) - .stream() - .collect( Collectors.toList() ); - - for ( TimeMention timeMention : ProgressBar.wrap( timeMentions, fileName + ": Normalizing TimeMentions" ) ){ - normalize( jCas, DCT, fileName, timeMention ); - } - } - - private void normalize( JCas jCas, TimeSpan DCT, String fileName, TimeMention timeMention ){ - String normalizedTimex = getTimeML( DCT, timeMention, fileName ); - if ( normalizedTimex.length() > 0 ){ - Time time = timeMention.getTime(); - if (time == null){ - time = new Time( jCas ); - time.addToIndexes(); - } - time.setNormalizedForm( normalizedTimex ); - timeMention.setTime( time ); - } - } - - private String getTimeML( TimeSpan DCT, TimeMention timeMention, String fileName ){ - String rawTimeMention = timeMention.getCoveredText(); - String[] rawDateElements = rawTimeMention.split("/"); - List dateElements = new ArrayList<>(); - for ( String dateElement : rawDateElements ){ - try { - int elem = Integer.parseInt( dateElement ); - dateElements.add( elem ); - } catch ( Exception ignored ){} - } - // can also do this in a way that grabs stragglers - if ( dateElements.size() == 3 && rawDateElements.length == 3 ){ - // avoiding TimeNorm's issues with component order - // ambiguity since these notes were all generated - // at American hospitals and therefore modulo mistakes - // will all use the American convention - int month = dateElements.get( 0 ); - int date = dateElements.get( 1 ); - int raw_year = dateElements.get( 2 ); - int year; - if ( rawDateElements[2].length() == 2 ){ - year = raw_year + 2000; - } else { - year = raw_year; - } - TimeSpan parsedDate = null; - try{ - parsedDate = TimeSpan.of( year, month, date ); - String dateMLValue = parsedDate.timeMLValue(); - return dateMLValue; - } catch ( Exception ignored ){ - } - } - String unnormalizedTimex = String.join(" ", timeMention.getCoveredText().split("\\s")); - Temporal normalizedTimex = null; - try{ - try{ - normalizedTimex = timeLimiter - .callUninterruptiblyWithTimeout( - () -> normalizer.parse( unnormalizedTimex, DCT ).get(), - timeout, - TimeUnit.SECONDS ); - } catch ( Exception ignored ){ - LOGGER.error( fileName + ": Timenorm failed to normalize timex " + unnormalizedTimex ); - return ""; - } - } catch ( Exception ignored ){ - LOGGER.error( fileName + ": Timenorm failed to normalize timex " + unnormalizedTimex ); - return ""; - } - return normalizedTimex.timeMLValue(); - } - - // Code due to Sean - static private int parseInt( final Object value, final String name, final int defaultValue ) { - if ( value instanceof Integer ) { - return (Integer)value; - } else if ( value instanceof String ) { - try { - return Integer.parseInt( (String)value ); - } catch ( NumberFormatException nfE ) { - LOGGER.warn( "Could not parse " + name + " " + value + " as an integer" ); - } - } else { - LOGGER.warn( "Could not parse " + name + " " + value + " as an integer" ); - } - return defaultValue; - } - -} diff --git a/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/cc/NormalizedEventTimeAnaforaWriter.java b/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/cc/NormalizedEventTimeAnaforaWriter.java deleted file mode 100755 index f6bb674..0000000 --- a/timelines/instance-generator/src/main/java/org/apache/ctakes/temporal/cc/NormalizedEventTimeAnaforaWriter.java +++ /dev/null @@ -1,450 +0,0 @@ -package org.apache.ctakes.temporal.cc; - -import org.apache.ctakes.core.cc.AbstractJCasFileWriter; -import org.apache.ctakes.core.pipeline.PipeBitInfo; -import org.apache.ctakes.core.util.annotation.IdentifiedAnnotationUtil; -import org.apache.ctakes.core.util.annotation.OntologyConceptUtil; -import org.apache.ctakes.core.util.doc.SourceMetadataUtil; -import org.apache.ctakes.typesystem.type.constants.CONST; -import org.apache.ctakes.typesystem.type.refsem.Event; -import org.apache.ctakes.typesystem.type.refsem.EventProperties; -import org.apache.ctakes.typesystem.type.refsem.UmlsConcept; -import org.apache.ctakes.typesystem.type.structured.SourceData; -import org.apache.ctakes.typesystem.type.textsem.EventMention; -import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation; -import org.apache.ctakes.typesystem.type.textsem.MedicationMention; -import org.apache.ctakes.typesystem.type.textsem.TimeMention; -import org.apache.log4j.Logger; -import org.apache.uima.fit.descriptor.ConfigurationParameter; -import org.apache.uima.fit.util.JCasUtil; -import org.apache.uima.jcas.JCas; -import org.clulab.timenorm.scfg.Temporal; -import org.clulab.timenorm.scfg.TemporalExpressionParser; -import org.clulab.timenorm.scfg.TimeSpan; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import java.io.File; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.stream.Collectors; - -import static org.apache.ctakes.core.pipeline.PipeBitInfo.TypeProduct.BASE_TOKEN; -import static org.apache.ctakes.core.pipeline.PipeBitInfo.TypeProduct.DOCUMENT_ID_PREFIX; - -/** - * @author SPF , chip-nlp - * @since {3/2/2023} - */ -@PipeBitInfo( - name = "Event Time Anafora Writer", - description = "Writes Temporal Events and Times in Anafora format.", - role = PipeBitInfo.Role.WRITER, - usables = { DOCUMENT_ID_PREFIX, BASE_TOKEN } -) -final public class NormalizedEventTimeAnaforaWriter extends AbstractJCasFileWriter { - - final static private Logger LOGGER = Logger.getLogger( "EventTimeAnaforaWriter_NORM" ); - static private final TemporalExpressionParser normalizer = TemporalExpressionParser.en(); - - // for now give a 'non time' - //static private final TimeSpan dummyDCT = TimeSpan.of(, 4, 1); - - /** - * Sometimes you want a file extension that specifies specifics about the corpus, creator and phase. - * e.g. ".UmlsDeepPhe.dave.completed.xml" - */ - static public final String PARAM_FILE_EXTENSION = "FileExtension"; - @ConfigurationParameter( - name = PARAM_FILE_EXTENSION, - description = "The extension for the written files. Default is .EventTime.ctakes.completed.xml", - defaultValue = ".NormalizedTimexes.ctakes.completed.xml", - mandatory = false - ) - private String _fileExtension; - - /** - * Sometimes you want a file extension that specifies specifics about the corpus, creator and phase. - * e.g. ".UmlsDeepPhe.dave.completed.xml" - */ - static public final String PARAM_ONLY_TIME_EVENTS = "OnlyTemporalEvents"; - @ConfigurationParameter( - name = PARAM_ONLY_TIME_EVENTS, - description = "Only use temporal events, not those created by dictionary lookup. Default is yes.", - defaultValue = "yes", - mandatory = false - ) - private String _onlyTemporalEvents; - - - static private final String SAVE_TIME_PATTERN = "yyyy-MMdd-HH:mm"; - static private final SimpleDateFormat SAVE_TIME_FORMAT = new SimpleDateFormat( SAVE_TIME_PATTERN); - - - - - private boolean onlyTemporalEvents() { - return _onlyTemporalEvents.equalsIgnoreCase( "yes" ) - || _onlyTemporalEvents.equalsIgnoreCase( "true" ); - } - - /** - * Writes some document metadata and discovered event information. - */ - @Override - public void writeFile( final JCas jCas, - final String outputDir, - final String documentId, - final String fileName ) throws IOException { - final File file = new File( outputDir, fileName + _fileExtension ); - try { - final DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - final DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); - final Document doc = docBuilder.newDocument(); - - final Element rootElement = doc.createElement( "data" ); - rootElement.appendChild( createInfoElement( doc ) ); - rootElement.appendChild( createSchemaElement( doc ) ); - rootElement.appendChild( createAnnotationsElement( jCas, documentId, doc ) ); - doc.appendChild( rootElement ); - - // boilerplate xml-writing code: - final TransformerFactory transformerFactory = TransformerFactory.newInstance(); - final Transformer transformer = transformerFactory.newTransformer(); - transformer.setOutputProperty( OutputKeys.INDENT, "yes" ); - transformer.setOutputProperty( OutputKeys.METHOD, "xml" ); - final DOMSource source = new DOMSource( doc ); - final StreamResult result = new StreamResult( file ); - transformer.transform( source, result ); - } catch ( ParserConfigurationException | TransformerException multE ) { - throw new IOException( multE ); - } - } - - - static private Element createInfoElement( final Document doc ) { - final Element info = doc.createElement( "info" ); - final Element saveTime = doc.createElement( "savetime" ); - final String saveTimeText = SAVE_TIME_FORMAT.format( new Date() ); - saveTime.setTextContent( saveTimeText ); - final Element progress = doc.createElement( "progress" ); - progress.setTextContent( "completed" ); - info.appendChild( saveTime ); - info.appendChild( progress ); - return info; - } - - static private Element createSchemaElement( final Document doc ) { - final Element schema = doc.createElement( "schema" ); - schema.setAttribute( "path", "./" ); - schema.setAttribute( "protocol", "file" ); - schema.setTextContent( "temporal-schema_NORM.xml" ); - return schema; - } - - private Element createAnnotationsElement( final JCas jCas, - final String documentId, - final Document doc ) { - final Element annotations = doc.createElement( "annotations" ); - int nextIdNumber = addEventElements( jCas, documentId, 1, annotations, doc ); - nextIdNumber = addTimeElements( jCas, documentId, nextIdNumber, annotations, doc ); - return annotations; - } - - private int addEventElements( final JCas jCas, - final String documentId, - final int startId, - final Element annotations, - final Document doc ) { - final List eventMentions = new ArrayList<>( JCasUtil.select( jCas, EventMention.class ) ); - eventMentions.sort( Comparator.comparingInt( EventMention::getBegin ) - .thenComparingInt( EventMention::getEnd ) ); - final boolean onlyTemporalEvents = onlyTemporalEvents(); - int idNumber = startId; - for ( EventMention eventMention : eventMentions ) { - // this ensures we are only looking at THYME events and not ctakes-dictionary-lookup events - if ( onlyTemporalEvents && !eventMention.getClass().equals( EventMention.class ) ) { - continue; - } - annotations.appendChild( createEventElement( eventMention, documentId, idNumber, doc ) ); - idNumber++; - } - return idNumber + 1; - } - - static private Element createEventElement( final EventMention eventMention, - final String documentId, - final int idNumber, - final Document doc ) { - - final Element event = createBaseElement( eventMention, "EVENT", documentId, idNumber, doc ); - - event.appendChild( createEventPropertiesElement( eventMention, doc ) ); - return event; - } - - static private String trimTo8( final String text ) { - if ( text.length() <= 8 ) { - return text; - } - return "<" + text.substring( text.length() - 7); - } - - static private Element createEventPropertiesElement( final EventMention eventMention, - final Document doc ) { - - // just to make sure - Collection umlsConcepts = ( eventMention instanceof MedicationMention ) ? OntologyConceptUtil.getUmlsConcepts( eventMention ) : new HashSet<>(); - - String drugCUIs = umlsConcepts - .stream() - //.map( c -> trimTo8( c.getCui() ) ) - .map( UmlsConcept::getCui ) - .distinct() - .collect( Collectors.joining( "," ) ); - - //LOGGER.info( eventMention.getCoveredText() + " of type " + eventMention.getClass().getSimpleName() + " has CUIs: " + drugCUIs ); - - final Event event = eventMention.getEvent(); - - if ( event == null ) { - return createNullEventProperties( IdentifiedAnnotationUtil.isNegated( eventMention ) , doc , drugCUIs ); - } - - int certaintyClass = Optional.of( eventMention ) - .map( IdentifiedAnnotation::getUncertainty ) - .orElse( -1 ); - - - final Element properties = doc.createElement( "properties" ); - final EventProperties eventProperties = event.getProperties(); - Element docTimeRel = doc.createElement( "DocTimeRel" ); - final String dtrContent = eventProperties.getDocTimeRel(); - docTimeRel.setTextContent( dtrContent ); - final Element eventType = doc.createElement( "Type" ); - eventType.setTextContent( "N/A" ); - final Element degree = doc.createElement( "Degree" ); - degree.setTextContent( "N/A" ); - final Element polarity = doc.createElement( "Polarity" ); - final String polarityValue = IdentifiedAnnotationUtil.isNegated( eventMention ) ? "NEG" : "POS"; - polarity.setTextContent( polarityValue ); - - - - final Element contextMode = doc.createElement( "ContextualModality" ); - contextMode.setTextContent( eventProperties.getContextualModality() ); - final Element contextAspect = doc.createElement( "ContextualAspect" ); - contextAspect.setTextContent( eventProperties.getContextualAspect() ); - final Element Permanence = doc.createElement( "Permanence" ); - Permanence.setTextContent( "UNDETERMINED" ); - final Element cuiElement = doc.createElement("CUI"); - cuiElement.setTextContent( drugCUIs ); - - final Element textLiteralElement = doc.createElement("Text"); - textLiteralElement.setTextContent( eventMention.getCoveredText() ); - - properties.appendChild( docTimeRel ); - properties.appendChild( polarity ); - properties.appendChild( degree ); - properties.appendChild( eventType ); - properties.appendChild( contextMode ); - properties.appendChild( contextAspect ); - properties.appendChild( Permanence ); - properties.appendChild( cuiElement ); - properties.appendChild( textLiteralElement ); - if ( certaintyClass > -1 ) { - String certaintyString = certaintyClass == CONST.NE_UNCERTAINTY_ABSENT ? "certain" : "uncertain"; - final Element certaintyElem = doc.createElement( "Certainty" ); - certaintyElem.setTextContent( certaintyString ); - properties.appendChild( certaintyElem ); - } - return properties; - } - - static private Element createNullEventProperties( final boolean isNegated, final Document doc, final String drugCUIs ) { - final Element properties = doc.createElement( "properties" ); - Element docTimeRel = doc.createElement( "DocTimeRel" ); - docTimeRel.setTextContent( "Overlap" ); - final Element eventType = doc.createElement( "Type" ); - eventType.setTextContent( "N/A" ); - final Element degree = doc.createElement( "Degree" ); - degree.setTextContent( "N/A" ); - final Element polarity = doc.createElement( "Polarity" ); - final String polarityValue = isNegated ? "NEG" : "POS"; - polarity.setTextContent( polarityValue ); - final Element contextMode = doc.createElement( "ContextualModality" ); - contextMode.setTextContent( "UNDETERMINED" ); - final Element contextAspect = doc.createElement( "ContextualAspect" ); - contextAspect.setTextContent( "UNDETERMINED" ); - final Element Permanence = doc.createElement( "Permanence" ); - Permanence.setTextContent( "UNDETERMINED" ); - final Element cuiElement = doc.createElement("CUI"); - cuiElement.setTextContent( drugCUIs ); - - properties.appendChild( docTimeRel ); - properties.appendChild( polarity ); - properties.appendChild( degree ); - properties.appendChild( eventType ); - properties.appendChild( contextMode ); - properties.appendChild( contextAspect ); - properties.appendChild( Permanence ); - properties.appendChild( cuiElement ); - return properties; - } - - - private int addTimeElements( final JCas jCas, - final String documentId, - final int startId, - final Element annotations, - final Document doc ) { - final SourceData sourceData = SourceMetadataUtil.getOrCreateSourceData( jCas ); - final String docTime = sourceData.getSourceOriginalDate(); - - TimeSpan DCT = null; - - - if ( docTime == null || docTime.isEmpty() ){ - LOGGER.warn( "Empty DCT, not creating the node" ); - } else { - String[] docTimeComponents = docTime.split("-"); - - - // properly generated - if (docTimeComponents.length == 3) { - DCT = TimeSpan.of( - Integer.parseInt(docTimeComponents[0]), - Integer.parseInt(docTimeComponents[1]), - Integer.parseInt(docTimeComponents[2])); - } else { - // DocTimeApproximator generated - DCT = TimeSpan.of( - Integer.parseInt(docTime.substring(0, 4)), - Integer.parseInt(docTime.substring(4, 6)), - Integer.parseInt(docTime.substring(6, 8))); - } - } - - - final List timeMentions = new ArrayList<>( JCasUtil.select( jCas, TimeMention.class ) ); - timeMentions.sort( Comparator.comparingInt( TimeMention::getBegin ) - .thenComparingInt( TimeMention::getEnd ) ); - int idNumber = startId; - - // DOCTIME - if ( DCT != null ) { - annotations.appendChild(createDOCTIME(DCT.timeMLValue(), documentId, idNumber, doc)); - idNumber++; - } - - for ( TimeMention timeMention : timeMentions ) { - annotations.appendChild( createTimeElement( timeMention, DCT, documentId, idNumber, doc ) ); - idNumber++; - } - - - - return idNumber + 1; - } - - static private Element createTimeElement( final TimeMention timeMention, - final TimeSpan DCT, - final String documentId, - final int idNumber, - final Document doc ) { - final Element properties = doc.createElement( "properties" ); - String typeName = ""; - String unnormalizedTimex = timeMention.getCoveredText(); - Temporal normalizedTimex = null; - try{ - normalizedTimex = normalizer.parse( unnormalizedTimex, DCT ).get(); - } catch (Exception ignored){} - - - final Element normalizedExpression = doc.createElement( "normalizedExpression" ); - if ( normalizedTimex != null ){ - normalizedExpression.setTextContent( normalizedTimex.timeMLValue() ); - } else { - System.err.println("Resorting to unnormalized timex: " + unnormalizedTimex ); - normalizedExpression.setTextContent( unnormalizedTimex ); - } - - final String timeClass = timeMention.getTimeClass(); - if ( timeClass != null && ( timeClass.equals( "DOCTIME" ) || timeClass.equals( "SECTIONTIME" ) ) ) { - typeName = timeClass; - properties.appendChild( normalizedExpression ); - } else { // inserting and normalizing here - typeName = "TIMEX3"; - final Element classE = doc.createElement( "Class" ); - classE.setTextContent( timeClass ); - properties.appendChild( classE ); - properties.appendChild( normalizedExpression ); - - } - final Element time = createBaseElement( timeMention, typeName, documentId, idNumber, doc ); - time.appendChild( properties ); - return time; - } - - - static private Element createBaseElement( final IdentifiedAnnotation annotation, - final String typeName, - final String documentId, - final int idNumber, - final Document doc ) { - - final Element base = doc.createElement( "entity" ); - final String eventID = idNumber + "@e@" + documentId + "@system"; - final Element id = doc.createElement( "id" ); - id.setTextContent( eventID ); - final Element span = doc.createElement( "span" ); - span.setTextContent( annotation.getBegin() + "," + annotation.getEnd() ); - final Element type = doc.createElement( "type" ); - type.setTextContent( typeName ); - final Element parentsType = doc.createElement( "parentsType" ); - parentsType.setTextContent( "TemporalEntities" ); - base.appendChild( id ); - base.appendChild( span ); - base.appendChild( type ); - base.appendChild( parentsType ); - return base; - } - - static private Element createDOCTIME( final String normalizedTimex, - final String documentId, - final int idNumber, - final Document doc ) { - - final Element docTimeNode = doc.createElement( "entity" ); - final String eventID = idNumber + "@e@" + documentId + "@system"; - final Element id = doc.createElement( "id" ); - id.setTextContent( eventID ); - final Element type = doc.createElement( "type" ); - type.setTextContent( "DOCTIME" ); - final Element parentsType = doc.createElement( "parentsType" ); - parentsType.setTextContent( "TemporalEntities" ); - - final Element properties = doc.createElement( "properties" ); - final Element normalizedExpression = doc.createElement( "normalizedExpression" ); - normalizedExpression.setTextContent( normalizedTimex ); - properties.appendChild( normalizedExpression ); - - - docTimeNode.appendChild( id ); - docTimeNode.appendChild( type ); - docTimeNode.appendChild( parentsType ); - docTimeNode.appendChild( properties ); - - return docTimeNode; - } -} diff --git a/timelines/instance-generator/src/user/resources/org/apache/ctakes/timelines/pipeline/Timelines.piper b/timelines/instance-generator/src/user/resources/org/apache/ctakes/timelines/pipeline/Timelines.piper index b299fec..7efd374 100755 --- a/timelines/instance-generator/src/user/resources/org/apache/ctakes/timelines/pipeline/Timelines.piper +++ b/timelines/instance-generator/src/user/resources/org/apache/ctakes/timelines/pipeline/Timelines.piper @@ -30,6 +30,6 @@ add TokenizerAnnotatorPTB add BackwardsTimeAnnotator classifierJarPath=/org/apache/ctakes/temporal/models/timeannotator/model.jar add DCTAnnotator -add TimeMentionNormalizer timeout=10 +// add TimeMentionNormalizer timeout=10 add PbjJmsSender SendQueue=JavaToPy SendStop=yes \ No newline at end of file diff --git a/timelines/instance-generator/src/user/resources/org/apache/ctakes/timelines/timelines_py/src/timelines/timeline_annotator.py b/timelines/instance-generator/src/user/resources/org/apache/ctakes/timelines/timelines_py/src/timelines/timeline_annotator.py index 2979ede..9cafee0 100755 --- a/timelines/instance-generator/src/user/resources/org/apache/ctakes/timelines/timelines_py/src/timelines/timeline_annotator.py +++ b/timelines/instance-generator/src/user/resources/org/apache/ctakes/timelines/timelines_py/src/timelines/timeline_annotator.py @@ -208,7 +208,7 @@ def _normalize_mention(mention: Union[FeatureStructure, None]) -> str: @staticmethod def _tokens_and_map( - cas: Cas, context: Optional[FeatureStructure] = None, mode="conmod" + cas: Cas, context: Optional[FeatureStructure] = None, mode="conmod" ) -> Tuple[List[str], List[Tuple[int, int]]]: base_tokens = [] token_map = [] @@ -262,7 +262,7 @@ def _tags_to_indices(tagged_sentence: str) -> List[Tuple[int, int]]: @staticmethod def _invert_map( - token_map: List[Tuple[int, int]] + token_map: List[Tuple[int, int]] ) -> Tuple[Dict[int, int], Dict[int, int]]: begin_map: Dict[int, int] = {} end_map: Dict[int, int] = {} @@ -325,7 +325,7 @@ def _get_tlink_classifications( @staticmethod def _timexes_with_normalization( - timexes: List[FeatureStructure], + timexes: List[FeatureStructure], ) -> List[FeatureStructure]: def relevant(timex): return hasattr(timex, "time") and hasattr(timex.time, "normalizedForm") @@ -334,11 +334,11 @@ def relevant(timex): @staticmethod def _get_tlink_instance( - event: FeatureStructure, - timex: FeatureStructure, - tokens: List[str], - begin2token: Dict[int, int], - end2token: Dict[int, int], + event: FeatureStructure, + timex: FeatureStructure, + tokens: List[str], + begin2token: Dict[int, int], + end2token: Dict[int, int], ) -> str: # Have an event and a timex/other event which are up to 60 tokens apart from each other # have two tokens before first annotation, first annotation plus tags @@ -374,19 +374,19 @@ def _get_tlink_instance( str_builder = ( # first two tokens - tokens[start_token_idx:first_begin] - # tag body of the first mention - + [first_open_tag] - + tokens[first_begin:first_end] - + [first_close_tag] - # intermediate part of the window - + tokens[first_end:second_begin] - # tag body of the second mention - + [second_open_tag] - + tokens[second_begin:second_end] - + [second_close_tag] - # ending part of the window - + tokens[second_end:end_token_idx] + tokens[start_token_idx:first_begin] + # tag body of the first mention + + [first_open_tag] + + tokens[first_begin:first_end] + + [first_close_tag] + # intermediate part of the window + + tokens[first_end:second_begin] + # tag body of the second mention + + [second_open_tag] + + tokens[second_begin:second_end] + + [second_close_tag] + # ending part of the window + + tokens[second_end:end_token_idx] ) result = " ".join(str_builder) return result diff --git a/timelines/pom.xml b/timelines/pom.xml index 537c118..8373118 100755 --- a/timelines/pom.xml +++ b/timelines/pom.xml @@ -4,21 +4,21 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> org.healthnlp - 5.0.0-SNAPSHOT + 7.0.0-SNAPSHOT 4.0.0 txtimelines-lookup pom + 2.12.8 - 8 - 8 - 5.0.0-SNAPSHOT + 17 + 17 + 7.0.0-SNAPSHOT true - tweaked-timenorm instance-generator @@ -27,6 +27,11 @@ scala-library ${scala.version} + + org.scala-sbt + compiler-bridge_2.13 + 1.9.6 + org.apache.ctakes ctakes-core @@ -110,7 +115,7 @@ ${project.basedir}/resources - + diff --git a/timelines/tweaked-timenorm/LICENSE b/timelines/tweaked-timenorm/LICENSE deleted file mode 100755 index 261eeb9..0000000 --- a/timelines/tweaked-timenorm/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/timelines/tweaked-timenorm/README.md b/timelines/tweaked-timenorm/README.md deleted file mode 100755 index 498732c..0000000 --- a/timelines/tweaked-timenorm/README.md +++ /dev/null @@ -1,132 +0,0 @@ -# timenorm - -The timenorm library provides models for finding natural language expressions -of dates and times and converting them to a normalized form. - -## Text to time expressions with the neural parser - -The primary entry point for the library is the `TemporalNeuralParser` class, -which implements a character-based recurrent neural network for finding and -normalizing time expressions, as described in: - -> Egoitz Laparra, Dongfang Xu, and Steven Bethard. 2018. -> [From Characters to Time Intervals: New Paradigms for Evaluation and Neural Parsing of Time Normalizations](https://www.mitpressjournals.org/doi/pdf/10.1162/tacl_a_00025). -> In: Transactions of the Association for Computational Linguistics 2018, Vol. 6, pp. 343–356 - -> Dongfang Xu, Egoitz Laparra and Steven Bethard. 2019. -> [Pre-trained Contextualized Character Embeddings Lead to Major Improvements in Time Normalization: a Detailed Analysis](https://www.aclweb.org/anthology/S19-1008). -> In: Proceedings of The Eighth Joint Conference on Lexical and Computational Semantics. - -To use the parser, create an instance of `TemporalNeuralParser`, and provide -as an anchor the time at which your text was written. - -```scala -scala> import org.clulab.timenorm.scate._ -import org.clulab.timenorm.scate._ - -scala> val parser = new TemporalNeuralParser -parser: org.clulab.timenorm.scate.TemporalNeuralParser = org.clulab.timenorm.scate.TemporalNeuralParser@44c2e8a8 - -scala> val anchor = SimpleInterval.of(2019, 5, 30) -anchor: org.clulab.timenorm.scate.SimpleInterval = SimpleInterval(2019-05-30T00:00,2019-05-31T00:00) -``` - -When you pass text to the parser, it will return the predicted time -expressions. Each time expression contains the span of characters that evoked -the time expression. Interval-type time expressions also contain their start -and endpoints on the timeline. - -```scala -scala> val text = "I have not seen her since last year. We hope to meet in the next two weeks." -text: String = I have not seen her since last year. We hope to meet in the next two weeks. -scala> for (timex <- parser.parse(text, anchor)) timex match { - | case interval: Interval => - | val Some((charStart, charEnd)) = interval.charSpan - | println(s"${interval.start} ${interval.end} ${text.substring(charStart, charEnd)}") - | } - -2018-01-01T00:00 2019-05-31T00:00 since last year -2019-05-31T00:00 2019-06-14T00:00 next two weeks -``` - -The parser runs faster if you pass batches of texts via the `parseBatch` -(instead of the `parse`) method. So if you know, say, the sentence segmentation -for your text, you may prefer to use that method. - -## Semantically compositional time operators - -The `TimeExpression` objects returned by the neural parser are based on the set -of semantically compositional operators described in: - -> Steven Bethard and Jonathan Parker. 2016. -> [A Semantically Compositional Annotation Scheme for Time Normalization](http://www.lrec-conf.org/proceedings/lrec2016/pdf/288_Paper.pdf). -> In: Proceedings of the Tenth International Conference on Language -> Resources and Evaluation (LREC 2016). pp. 3779-3786. - -If you would like to manually construct complex time expressions, the operators -are available in the `org.clulab.timenorm.scate` package, and can be combined -with fields and units from the `java.time` library: - -```scala -scala> import org.clulab.timenorm.scate._, java.time.temporal.ChronoField._, java.time.temporal.ChronoUnit._ -import org.clulab.timenorm.scate._ -import java.time.temporal.ChronoField._ -import java.time.temporal.ChronoUnit._ - -scala> // the 3-year period following the year 1985 -scala> NextP(Year(1985), SimplePeriod(YEARS, 3)) -res0: org.clulab.timenorm.scate.NextP = NextP(Year(1985,0,None),SimplePeriod(Years,IntNumber(3,None),None,None),None) - -scala> (res0.start, res0.end) -res1: (java.time.LocalDateTime, java.time.LocalDateTime) = (1986-01-01T00:00,1989-01-01T00:00) - -scala> // the Friday the 13th following the 15th day of the 3rd month of 1985 -scala> NextRI( - | ThisRI( - | ThisRI( - | Year(1985), - | RepeatingField(MONTH_OF_YEAR, 3)), - | RepeatingField(DAY_OF_MONTH, 15)), - | IntersectionRI(Set( - | RepeatingField(DAY_OF_WEEK, 5), - | RepeatingField(DAY_OF_MONTH, 13)))) -res2: org.clulab.timenorm.scate.NextRI = NextRI(ThisRI(ThisRI(Year(1985,0,None),RepeatingField(MonthOfYear,3,None,None),None),RepeatingField(DayOfMonth,15,None,None),None),IntersectionRI(Set(RepeatingField(DayOfWeek,5,None,None), RepeatingField(DayOfMonth,13,None,None)),None),,None) - -scala> (res2.start, res2.end) -res3: (java.time.LocalDateTime, java.time.LocalDateTime) = (1985-09-13T00:00,1985-09-14T00:00) -``` - -## Normalizing time expressions with a synchronous context free grammar - -*This portion of the library is no longer recommended, but it is still included -in the distribution.* - -The `scfg` portion of the library can take a time expression and normalize it -to TimeML format using a synchronous context free grammar, as described in: - -> Steven Bethard. 2013. -> [A Synchronous Context Free Grammar for Time Normalization](http://www.aclweb.org/anthology/D13-1078). -> In: Proceedings of the 2013 Conference on Empirical Methods in Natural -> Language Processing, pp. 821-826. - -Note that the `scfg` model cannot find time expressions in text; it can only -normalize them after they are found. Sample usage: - -```scala -scala> import org.clulab.timenorm.scfg._, scala.util.Success -import org.clulab.timenorm.scfg._ -import scala.util.Success - -scala> val parser = TemporalExpressionParser.en // English, Italian, and also Spanish are available. -parser: org.clulab.timenorm.scfg.TemporalExpressionParser = org.clulab.timenorm.scfg.TemporalExpressionParser@d653e41 - -scala> val Success(temporal) = parser.parse("two weeks ago", TimeSpan.of(2013, 1, 4)) -temporal: org.clulab.timenorm.scfg.Temporal = TimeSpan(2012-12-17T00:00Z,2012-12-24T00:00Z,Period(Map(Weeks -> 1),Exact),Exact) - -scala> temporal.timeMLValue -res0: String = 2012-W51 -``` - -### Languages - -The `TemporalExpressionParser` is available in three languages: English (en), Italian (it), Spanish (es). The last is thanks to contributions of [@NGEscribano ](https://github.com/NGEscribano) from the [timenorm-es](https://github.com/NGEscribano/timenorm-es) project which includes additional helpful information in its [Spanish TimeNorm](https://github.com/NGEscribano/timenorm-es#readme) document. diff --git a/timelines/tweaked-timenorm/pom.xml b/timelines/tweaked-timenorm/pom.xml deleted file mode 100755 index a215c9c..0000000 --- a/timelines/tweaked-timenorm/pom.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - txtimelines-lookup - org.healthnlp - 5.0.0-SNAPSHOT - - 4.0.0 - tweaked-timenorm - jar - - 8 - 8 - true - - Find and converts natural language expressions of dates and times to their normalized form. - https://github.com/example/project - - - Apache 2 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - timenorm - - computational language understanding lab - http://clulab.org/ - - - - bethard - Steven Bethard - https://bethard.faculty.arizona.edu/ - bethard@email.arizona.edu - - - EgoLaparra - Egoitz Laparra - http://clulab.cs.arizona.edu/people.php - laparra@email.arizona.edu - - - - - commons-io - commons-io - 2.11.0 - - - org.scala-lang.modules - scala-xml_2.12 - 2.1.0 - - - com.typesafe.play - play-json_2.12 - 2.9.4 - - - - - - net.alchim31.maven - scala-maven-plugin - 4.8.1 - - - scala-compile - - add-source - compile - testCompile - - - - - - - diff --git a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/en.grammar b/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/en.grammar deleted file mode 100755 index d17c674..0000000 --- a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/en.grammar +++ /dev/null @@ -1,532 +0,0 @@ -ROOTS [Period] [PeriodSet] [TimeSpan] [TimeSpanSet] - -// ==================================================================================== -// expressions that appear in other places in the grammar but can sometimes be ignored -// (if an expression occurs nowhere in the grammar, it does not need to be listed here) -// ==================================================================================== -[Nil] ||| a ||| ||| 1.0 -[Nil] ||| the ||| ||| 1.0 -[Nil] ||| . ||| ||| 1.0 -[Nil] ||| - ||| ||| 1.0 -[Nil] ||| / ||| ||| 1.0 -[Nil] ||| ' s ||| ||| 1.0 -[Nil] ||| each of ||| ||| 1.0 -[Nil] ||| more ||| ||| 1.0 - -// ==================================== -// expressions that identify an integer -// ==================================== -[Int:1Digit] ||| one ||| 1 ||| 1.0 -[Int:1Digit] ||| two ||| 2 ||| 1.0 -[Int:1Digit] ||| three ||| 3 ||| 1.0 -[Int:1Digit] ||| four ||| 4 ||| 1.0 -[Int:1Digit] ||| five ||| 5 ||| 1.0 -[Int:1Digit] ||| six ||| 6 ||| 1.0 -[Int:1Digit] ||| seven ||| 7 ||| 1.0 -[Int:1Digit] ||| eight ||| 8 ||| 1.0 -[Int:1Digit] ||| nine ||| 9 ||| 1.0 -[Int:Teens] ||| ten ||| 1 0 ||| 1.0 -[Int:Teens] ||| eleven ||| 1 1 ||| 1.0 -[Int:Teens] ||| twelve ||| 1 2 ||| 1.0 -[Int:Teens] ||| thirteen ||| 1 3 ||| 1.0 -[Int:Teens] ||| fourteen ||| 1 4 ||| 1.0 -[Int:Teens] ||| fifteen ||| 1 5 ||| 1.0 -[Int:Teens] ||| sixteen ||| 1 6 ||| 1.0 -[Int:Teens] ||| seventeen ||| 1 7 ||| 1.0 -[Int:Teens] ||| eighteen ||| 1 8 ||| 1.0 -[Int:Teens] ||| nineteen ||| 1 9 ||| 1.0 -[Int:Tens] ||| twenty ||| 2 ||| 1.0 -[Int:Tens] ||| thirty ||| 3 ||| 1.0 -[Int:Tens] ||| forty ||| 4 ||| 1.0 -[Int:Tens] ||| fifty ||| 5 ||| 1.0 -[Int:Tens] ||| sixty ||| 6 ||| 1.0 -[Int:Tens] ||| seventy ||| 7 ||| 1.0 -[Int:Tens] ||| eighty ||| 8 ||| 1.0 -[Int:Tens] ||| ninety ||| 9 ||| 1.0 -[Int:2Digit] ||| [Int:Teens] ||| [Int:Teens] ||| 1.0 -[Int:2Digit] ||| [Int:Tens] ||| [Int:Tens] 0 ||| 1.0 -[Int:2Digit] ||| [Int:Tens] [Int:1Digit] ||| [Int:Tens] [Int:1Digit] ||| 1.0 -[Int:Hundred2Digit] ||| hundred ||| 0 0 ||| 1.0 -[Int:Hundred2Digit] ||| hundred [Int:1Digit] ||| 0 [Int:1Digit] ||| 1.0 -[Int:Hundred2Digit] ||| hundred [Int:2Digit] ||| [Int:2Digit] ||| 1.0 -[Int:3Digit] ||| [Int:Hundred2Digit] ||| 1 [Int:Hundred2Digit] ||| 1.0 -[Int:3Digit] ||| [Int:1Digit] [Int:Hundred2Digit] ||| [Int:1Digit] [Int:Hundred2Digit] ||| 1.0 -[Int:Thousand3Digit] ||| thousand ||| 0 0 0 ||| 1.0 -[Int:Thousand3Digit] ||| thousand [Int:1Digit] ||| 0 0 [Int:1Digit] ||| 1.0 -[Int:Thousand3Digit] ||| thousand [Int:2Digit] ||| 0 [Int:2Digit] ||| 1.0 -[Int:Thousand3Digit] ||| thousand [Int:3Digit] ||| [Int:3Digit] ||| 1.0 -[Int:4Digit] ||| [Int:Thousand3Digit] ||| 1 [Int:Thousand3Digit] ||| 1.0 -[Int:4Digit] ||| [Int:1Digit] [Int:Thousand3Digit] ||| [Int:1Digit] [Int:Thousand3Digit] ||| 1.0 -[Int:4Digit] ||| [Int:2Digit,1] [Int:2Digit,2] ||| [Int:2Digit,1] [Int:2Digit,2] ||| 1.0 -[Int] ||| [Int:1Digit] ||| [Int:1Digit] ||| 1.0 -[Int] ||| [Int:2Digit] ||| [Int:2Digit] ||| 1.0 -[Int] ||| [Int:3Digit] ||| [Int:3Digit] ||| 1.0 -[Int] ||| [Int:4Digit] ||| [Int:4Digit] ||| 1.0 - -// ==================================== -// ordinal numbers that map to integers -// ==================================== -[FieldValue:OrdinalDayOfMonth] ||| [Int] st ||| DAY_OF_MONTH [Int] ||| 1.0 -[FieldValue:OrdinalDayOfMonth] ||| [Int] nd ||| DAY_OF_MONTH [Int] ||| 1.0 -[FieldValue:OrdinalDayOfMonth] ||| [Int] rd ||| DAY_OF_MONTH [Int] ||| 1.0 -[FieldValue:OrdinalDayOfMonth] ||| [Int] th ||| DAY_OF_MONTH [Int] ||| 1.0 - -// ================================================= -// other common expressions that identify an integer -// ================================================= -[Int] ||| couple ||| 2 ||| 1.0 -[Int] ||| couple of ||| 2 ||| 1.0 - -// ========================================= -// expressions that identify a temporal unit -// ========================================= -[Unit:Singular] ||| second ||| SECONDS ||| 1.0 -[Unit:Singular] ||| minute ||| MINUTES ||| 1.0 -[Unit:Singular] ||| hour ||| HOURS ||| 1.0 -[Unit:Singular] ||| day ||| DAYS ||| 1.0 -[Unit:Singular] ||| week ||| WEEKS ||| 1.0 -[Unit:Singular] ||| month ||| MONTHS ||| 1.0 -[Unit:Singular] ||| period ||| QUARTER_YEARS ||| 1.0 -[Unit:Singular] ||| quarter ||| QUARTER_YEARS ||| 1.0 -[Unit:Singular] ||| year ||| YEARS ||| 1.0 -[Unit:Singular] ||| decade ||| DECADES ||| 1.0 -[Unit:Singular] ||| century ||| CENTURIES ||| 1.0 -[Unit] ||| [Unit:Singular] ||| [Unit:Singular] ||| 1.0 -[Unit:Plural] ||| seconds ||| SECONDS ||| 1.0 -[Unit:Plural] ||| minutes ||| MINUTES ||| 1.0 -[Unit:Plural] ||| hours ||| HOURS ||| 1.0 -[Unit:Plural] ||| days ||| DAYS ||| 1.0 -[Unit:Plural] ||| weeks ||| WEEKS ||| 1.0 -[Unit:Plural] ||| months ||| MONTHS ||| 1.0 -[Unit:Plural] ||| quarters ||| QUARTER_YEARS ||| 1.0 -[Unit:Plural] ||| years ||| YEARS ||| 1.0 -[Unit:Plural] ||| decades ||| DECADES ||| 1.0 -[Unit:Plural] ||| centuries ||| CENTURIES ||| 1.0 -[Unit] ||| [Unit:Plural] ||| [Unit:Plural] ||| 1.0 - -// ========================================= -// expressions that identify a part of a day -// ========================================= -[FieldValue:HourOfDay] ||| [Int:0-23] ||| HOUR_OF_DAY [Int:0-23] ||| 1.0 -[FieldValue:HourOfAMPM] ||| [Int:1-12] ||| HOUR_OF_AMPM [Int:1-12] ||| 1.0 -[FieldValue:MinuteOfHour] ||| [Int:0-59] ||| MINUTE_OF_HOUR [Int:0-59] ||| 1.0 -[FieldValue:SecondOfMinute] ||| [Int:0-59] ||| SECOND_OF_MINUTE [Int:0-59] ||| 1.0 -[FieldValue:AMPMOfDay] ||| a . m ||| AMPM_OF_DAY 0 ||| 1.0 -[FieldValue:AMPMOfDay] ||| am ||| AMPM_OF_DAY 0 ||| 1.0 -[FieldValue:AMPMOfDay] ||| in the morning ||| AMPM_OF_DAY 0 ||| 1.0 -[FieldValue:AMPMOfDay] ||| p . m ||| AMPM_OF_DAY 1 ||| 1.0 -[FieldValue:AMPMOfDay] ||| pm ||| AMPM_OF_DAY 1 ||| 1.0 -[FieldValue:AMPMOfDay] ||| in the afternoon ||| AMPM_OF_DAY 1 ||| 1.0 -[FieldValue:AMPMOfDay] ||| in the evening ||| AMPM_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| morning ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| afternoon ||| AFTERNOON_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| evening ||| EVENING_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| night ||| NIGHT_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| overnight ||| NIGHT_OF_DAY 1 ||| 1.0 - -// =========================================== -// expressions that identify a day of the week -// =========================================== -[FieldValue:DayOfWeek] ||| monday ||| DAY_OF_WEEK 1 ||| 1.0 -[FieldValue:DayOfWeek] ||| tuesday ||| DAY_OF_WEEK 2 ||| 1.0 -[FieldValue:DayOfWeek] ||| wednesday ||| DAY_OF_WEEK 3 ||| 1.0 -[FieldValue:DayOfWeek] ||| thursday ||| DAY_OF_WEEK 4 ||| 1.0 -[FieldValue:DayOfWeek] ||| friday ||| DAY_OF_WEEK 5 ||| 1.0 -[FieldValue:DayOfWeek] ||| saturday ||| DAY_OF_WEEK 6 ||| 1.0 -[FieldValue:DayOfWeek] ||| sunday ||| DAY_OF_WEEK 7 ||| 1.0 -[FieldValue:DayOfWeek] ||| mon ||| DAY_OF_WEEK 1 ||| 1.0 -[FieldValue:DayOfWeek] ||| tue ||| DAY_OF_WEEK 2 ||| 1.0 -[FieldValue:DayOfWeek] ||| tues ||| DAY_OF_WEEK 2 ||| 1.0 -[FieldValue:DayOfWeek] ||| wed ||| DAY_OF_WEEK 3 ||| 1.0 -[FieldValue:DayOfWeek] ||| thu ||| DAY_OF_WEEK 4 ||| 1.0 -[FieldValue:DayOfWeek] ||| thur ||| DAY_OF_WEEK 4 ||| 1.0 -[FieldValue:DayOfWeek] ||| thurs ||| DAY_OF_WEEK 4 ||| 1.0 -[FieldValue:DayOfWeek] ||| fri ||| DAY_OF_WEEK 5 ||| 1.0 -[FieldValue:DayOfWeek] ||| sat ||| DAY_OF_WEEK 6 ||| 1.0 -[FieldValue:DayOfWeek] ||| sun ||| DAY_OF_WEEK 7 ||| 1.0 - -// ============================================= -// expressions that identify a weekend of a week -// ============================================= -[FieldValue:WeekendOfWeek] ||| weekend ||| WEEKEND_OF_WEEK 1 ||| 1.0 - -// ========================================== -// expressions that identify a day of a month -// ========================================== -[FieldValue:NumericDayOfMonth] ||| [Int:1-31] ||| DAY_OF_MONTH [Int:1-31] ||| 1.0 - -// ============================================= -// expressions that identify a month of the year -// ============================================= -[FieldValue:MonthOfYear] ||| january ||| MONTH_OF_YEAR 1 ||| 1.0 -[FieldValue:MonthOfYear] ||| february ||| MONTH_OF_YEAR 2 ||| 1.0 -[FieldValue:MonthOfYear] ||| march ||| MONTH_OF_YEAR 3 ||| 1.0 -[FieldValue:MonthOfYear] ||| april ||| MONTH_OF_YEAR 4 ||| 1.0 -[FieldValue:MonthOfYear] ||| may ||| MONTH_OF_YEAR 5 ||| 1.0 -[FieldValue:MonthOfYear] ||| june ||| MONTH_OF_YEAR 6 ||| 1.0 -[FieldValue:MonthOfYear] ||| july ||| MONTH_OF_YEAR 7 ||| 1.0 -[FieldValue:MonthOfYear] ||| august ||| MONTH_OF_YEAR 8 ||| 1.0 -[FieldValue:MonthOfYear] ||| september ||| MONTH_OF_YEAR 9 ||| 1.0 -[FieldValue:MonthOfYear] ||| october ||| MONTH_OF_YEAR 10 ||| 1.0 -[FieldValue:MonthOfYear] ||| november ||| MONTH_OF_YEAR 11 ||| 1.0 -[FieldValue:MonthOfYear] ||| december ||| MONTH_OF_YEAR 12 ||| 1.0 -[FieldValue:MonthOfYear] ||| jan ||| MONTH_OF_YEAR 1 ||| 1.0 -[FieldValue:MonthOfYear] ||| feb ||| MONTH_OF_YEAR 2 ||| 1.0 -[FieldValue:MonthOfYear] ||| mar ||| MONTH_OF_YEAR 3 ||| 1.0 -[FieldValue:MonthOfYear] ||| apr ||| MONTH_OF_YEAR 4 ||| 1.0 -[FieldValue:MonthOfYear] ||| may ||| MONTH_OF_YEAR 5 ||| 1.0 -[FieldValue:MonthOfYear] ||| jun ||| MONTH_OF_YEAR 6 ||| 1.0 -[FieldValue:MonthOfYear] ||| jul ||| MONTH_OF_YEAR 7 ||| 1.0 -[FieldValue:MonthOfYear] ||| aug ||| MONTH_OF_YEAR 8 ||| 1.0 -[FieldValue:MonthOfYear] ||| sep ||| MONTH_OF_YEAR 9 ||| 1.0 -[FieldValue:MonthOfYear] ||| sept ||| MONTH_OF_YEAR 9 ||| 1.0 -[FieldValue:MonthOfYear] ||| oct ||| MONTH_OF_YEAR 10 ||| 1.0 -[FieldValue:MonthOfYear] ||| nov ||| MONTH_OF_YEAR 11 ||| 1.0 -[FieldValue:MonthOfYear] ||| dec ||| MONTH_OF_YEAR 12 ||| 1.0 -[FieldValue:NumericMonthOfYear] ||| [Int:1-12] ||| MONTH_OF_YEAR [Int:1-12] ||| 1.0 - -// ====================================================== -// expressions that identify a fiscal quarter of the year -// ====================================================== -[FieldValue:QuarterOfYear] ||| first quarter ||| QUARTER_OF_YEAR 1 ||| 1.0 -[FieldValue:QuarterOfYear] ||| second quarter ||| QUARTER_OF_YEAR 2 ||| 1.0 -[FieldValue:QuarterOfYear] ||| third quarter ||| QUARTER_OF_YEAR 3 ||| 1.0 -[FieldValue:QuarterOfYear] ||| fourth quarter ||| QUARTER_OF_YEAR 4 ||| 1.0 -[FieldValue:QuarterOfYear] ||| first - quarter ||| QUARTER_OF_YEAR 1 ||| 1.0 -[FieldValue:QuarterOfYear] ||| second - quarter ||| QUARTER_OF_YEAR 2 ||| 1.0 -[FieldValue:QuarterOfYear] ||| third - quarter ||| QUARTER_OF_YEAR 3 ||| 1.0 -[FieldValue:QuarterOfYear] ||| fourth - quarter ||| QUARTER_OF_YEAR 4 ||| 1.0 - -// ============================================== -// expressions that identify a season of the year -// ============================================== -[FieldValue:SeasonOfYear] ||| spring ||| SPRING_OF_YEAR 1 ||| 1.0 -[FieldValue:SeasonOfYear] ||| summer ||| SUMMER_OF_YEAR 1 ||| 1.0 -[FieldValue:SeasonOfYear] ||| fall ||| FALL_OF_YEAR 1 ||| 1.0 -[FieldValue:SeasonOfYear] ||| autumn ||| FALL_OF_YEAR 1 ||| 1.0 -[FieldValue:SeasonOfYear] ||| winter ||| WINTER_OF_YEAR 1 ||| 1.0 - -// ======================================= -// expressions that identify a time of day -// ======================================= -[FieldValue:Time] ||| noon ||| ( FieldValue:HourOfDay HOUR_OF_DAY 12 ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| midday ||| ( FieldValue:HourOfDay HOUR_OF_DAY 12 ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| [FieldValue:HourOfDay] : [FieldValue:MinuteOfHour] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] ||| 1.0 -[FieldValue:Time] ||| [FieldValue:HourOfDay] : [FieldValue:MinuteOfHour] : [FieldValue:SecondOfMinute] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] [FieldValue:SecondOfMinute] ||| 1.0 -[FieldValue:Time] ||| [FieldValue:HourOfAMPM] : [FieldValue:MinuteOfHour] [FieldValue:AMPMOfDay] ||| [FieldValue:HourOfAMPM] [FieldValue:MinuteOfHour] [FieldValue:AMPMOfDay] ||| 1.0 -[FieldValue:Time] ||| [FieldValue:HourOfAMPM] [FieldValue:AMPMOfDay] ||| [FieldValue:HourOfAMPM] ( FieldValue MINUTE_OF_HOUR 0 ) [FieldValue:AMPMOfDay] ||| 1.0 - -// ============================================== -// expressions that identify specially named days -// ============================================== -[FieldValue:NamedDay] ||| thanksgiving ||| ( FieldValue DAY_OF_WEEK 4 ) ( FieldValue MONTH_OF_YEAR 11 ) ( FieldValue ALIGNED_WEEK_OF_MONTH 4 ) ||| 1.0 -[FieldValue:NamedDay] ||| christmas ||| ( FieldValue MONTH_OF_YEAR 12 ) ( FieldValue DAY_OF_MONTH 25 ) ||| 1.0 -[FieldValue:NamedDay] ||| easter ||| EASTER_DAY_OF_YEAR 1 ||| 1.0 -[FieldValue:NamedDay] ||| election ||| ( FieldValue DAY_OF_WEEK 2 ) ( FieldValue MONTH_OF_YEAR 11 ) ( FieldValue ALIGNED_WEEK_OF_MONTH 1 ) ||| 1.0 - -// ================================================ -// expressions that identify both a month and a day -// ================================================ -[FieldValue:MonthDay] ||| [FieldValue:NamedDay] ||| [FieldValue:NamedDay] ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:MonthOfYear] [FieldValue:DayOfMonth] ||| [FieldValue:MonthOfYear] [FieldValue:DayOfMonth] ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:MonthOfYear] [FieldValue:OrdinalDayOfMonth] ||| [FieldValue:MonthOfYear] [FieldValue:OrdinalDayOfMonth] ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:MonthOfYear] [FieldValue:NumericDayOfMonth] ||| [FieldValue:MonthOfYear] [FieldValue:NumericDayOfMonth] ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:NumericMonthOfYear] [FieldValue:NumericDayOfMonth] ||| [FieldValue:NumericMonthOfYear] [FieldValue:NumericDayOfMonth] ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:DayOfWeek] [FieldValue:MonthDay] ||| [FieldValue:DayOfWeek] [FieldValue:MonthDay] ||| 1.0 - -// =========================================================== -// combinations of time fields that don't fully specify a time -// =========================================================== -[FieldValue:PartialYear] ||| [Int:0-99] ||| YEAR_OF_CENTURY [Int:0-99] ||| 1.0 -[FieldValue:PartialTime] ||| [FieldValue:Time] ||| [FieldValue:Time] ||| 1.0 -[FieldValue:PartialTime] ||| [FieldValue:PartOfDay] ||| [FieldValue:PartOfDay] ||| 1.0 -[FieldValue:PartialYearMonthDay] ||| [FieldValue:DayOfWeek] ||| [FieldValue:DayOfWeek] ||| 1.0 -[FieldValue:PartialYearMonthDay] ||| [FieldValue:MonthDay] ||| [FieldValue:MonthDay] ||| 1.0 -[FieldValue:PartialYearMonthDay] ||| [FieldValue:MonthDay] [FieldValue:PartialYear] ||| [FieldValue:PartialYear] [FieldValue:MonthDay] ||| 1.0 -[FieldValue:PartialYearMonthDay] ||| [FieldValue:PartialYear] [FieldValue:MonthDay] ||| [FieldValue:PartialYear] [FieldValue:MonthDay] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:PartialTime] ||| [FieldValue:PartialTime] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:PartialYearMonthDay] ||| [FieldValue:PartialYearMonthDay] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:PartialYearMonthDay] [FieldValue:PartialTime] ||| [FieldValue:PartialYearMonthDay] [FieldValue:PartialTime] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:PartialTime] [FieldValue:PartialYearMonthDay] ||| [FieldValue:PartialYearMonthDay] [FieldValue:PartialTime] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:WeekendOfWeek] ||| [FieldValue:WeekendOfWeek] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:Month] ||| [FieldValue:Month] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:MonthOfYear] ||| [FieldValue:MonthOfYear] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:SeasonOfYear] ||| [FieldValue:SeasonOfYear] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:QuarterOfYear] ||| [FieldValue:QuarterOfYear] ||| 1.0 - -// =============================================================== -// combinations of time fields that fully specify an absolute time -// =============================================================== -[FieldValue:Year] ||| [Int:1000-9999] ||| YEAR [Int:1000-9999] ||| 1.0 -[FieldValue:Year] ||| [Int:4Digit] ||| YEAR [Int:4Digit] ||| 1.0 -// e.g. "the year 2000" -[FieldValue:Year] ||| year [FieldValue:Year] ||| [FieldValue:Year] ||| 1.0 -[FieldValue:YearMonth] ||| [FieldValue:MonthOfYear] [FieldValue:Year] ||| [FieldValue:Year] [FieldValue:MonthOfYear] ||| 1.0 -[FieldValue:YearMonth] ||| [FieldValue:Year] [FieldValue:MonthOfYear] ||| [FieldValue:Year] [FieldValue:MonthOfYear] ||| 1.0 -[FieldValue:YearMonthDay] ||| [FieldValue:Year] [FieldValue:MonthDay] ||| [FieldValue:Year] [FieldValue:MonthDay] ||| 1.0 -[FieldValue:YearMonthDay] ||| [FieldValue:MonthDay] [FieldValue:Year] ||| [FieldValue:Year] [FieldValue:MonthDay] ||| 1.0 -[FieldValue:Absolute] ||| [FieldValue:Year] ||| [FieldValue:Year] ||| 1.0 -[FieldValue:Absolute] ||| [FieldValue:Year] [FieldValue:QuarterOfYear] ||| [FieldValue:Year] [FieldValue:QuarterOfYear] ||| 1.0 -[FieldValue:Absolute] ||| [FieldValue:YearMonth] ||| [FieldValue:YearMonth] ||| 1.0 -[FieldValue:Absolute] ||| [FieldValue:YearMonthDay] ||| [FieldValue:YearMonthDay] ||| 1.0 -[FieldValue:Absolute] ||| [FieldValue:YearMonthDay] [FieldValue:Time] ||| [FieldValue:YearMonthDay] [FieldValue:Time] ||| 1.0 - -// ============================= -// expressions of simple periods -// ============================= -[Period] ||| [Unit:Singular] ||| Simple [Unit:Singular] ||| 1.0 -[Period] ||| [Int] [Unit] ||| Simple [Int] [Unit] ||| 1.0 -// e.g. "the first nine months" -[Period] ||| first [Int] [Unit] ||| Simple [Int] [Unit] ||| 1.0 -// e.g. "a three-year period" -[Period] ||| [Int] [Unit] period ||| Simple [Int] [Unit] ||| 1.0 - -// ============================================== -// expressions of periods with fractional amounts -// ============================================== -[Period] ||| [Int,1] [Int,2] / [Int,3] [Unit] ||| Fractional [Int,1] [Int,2] [Int,3] [Unit] ||| 1.0 -[Period] ||| [Unit:Singular] and a half ||| Fractional ( Int 1 ) ( Int 1 ) ( Int 2 ) [Unit:Singular] ||| 1.0 -[Period] ||| [Int] and a half [Unit] ||| Fractional [Int] ( Int 1 ) ( Int 2 ) [Unit] ||| 1.0 - -// ================================== -// expressions of unspecified periods -// ================================== -[Period] ||| a while ||| Unspecified UNSPECIFIED ||| 1.0 -[Period] ||| some time ||| Unspecified UNSPECIFIED ||| 1.0 -[Period] ||| lengthy period ||| Unspecified UNSPECIFIED ||| 1.0 -[Period] ||| several [Unit] ||| Unspecified [Unit] ||| 1.0 -[Period] ||| few [Unit] ||| Unspecified [Unit] ||| 1.0 -[Period] ||| recent [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 -[Period] ||| early [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 -[Period] ||| first [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 -// e.g. "weeks" -[Period] ||| [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 - -// ========================================== -// expressions that set time period modifiers -// ========================================== -[Period] ||| almost [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| about [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| around [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| [Period] or so ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| less than [Period] ||| WithModifier [Period] LESS_THAN ||| 1.0 -[Period] ||| nearly [Period] ||| WithModifier [Period] LESS_THAN ||| 1.0 -[Period] ||| more than [Period] ||| WithModifier [Period] MORE_THAN ||| 1.0 -[Period] ||| over [Period] ||| WithModifier [Period] MORE_THAN ||| 1.0 -[Period] ||| at least [Period] ||| WithModifier [Period] EQUAL_OR_MORE ||| 1.0 -[Period] ||| no more than [Period] ||| WithModifier [Period] EQUAL_OR_LESS ||| 1.0 -[Period] ||| up to [Period] ||| WithModifier [Period] EQUAL_OR_LESS ||| 1.0 - -// ========================== -// expressions of period sets -// ========================== -[PeriodSet] ||| hourly ||| WithQuantifier ( Period Simple 1 HOURS ) EVERY ||| 1.0 -[PeriodSet] ||| daily ||| WithQuantifier ( Period Simple 1 DAYS ) EVERY ||| 1.0 -[PeriodSet] ||| weekly ||| WithQuantifier ( Period Simple 1 WEEKS ) EVERY ||| 1.0 -[PeriodSet] ||| monthly ||| WithQuantifier ( Period Simple 1 MONTHS ) EVERY ||| 1.0 -[PeriodSet] ||| quarterly ||| WithQuantifier ( Period Simple 1 QUARTER_YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| yearly ||| WithQuantifier ( Period Simple 1 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| annually ||| WithQuantifier ( Period Simple 1 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| every [Period] ||| WithQuantifier [Period] EVERY ||| 1.0 -[PeriodSet] ||| each [Period] ||| WithQuantifier [Period] EACH ||| 1.0 - -// ======================================= -// time spans are either :Solo or :Regular -// ======================================= -[TimeSpan] ||| [TimeSpan:Solo] ||| [TimeSpan:Solo] ||| 1.0 -[TimeSpan] ||| [TimeSpan:Regular] ||| [TimeSpan:Regular] ||| 1.0 - -// ============================================================== -// expressions of time spans that can't be combined with anything -// ============================================================== -[TimeSpan:Solo] ||| the past ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| the time ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| previous ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| previously ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| recent ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| recently ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| once ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| earlier ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| then current ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| current ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| currently ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| already ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| this moment ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| these days ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| yet ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| future ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| soon ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| later date ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| later time ||| Simple FUTURE ||| 1.0 -// e.g. "the long term" -[TimeSpan:Solo] ||| the term ||| Simple FUTURE ||| 1.0 - -// ================================== -// expressions of absolute time spans -// ================================== -[TimeSpan:Regular] ||| [FieldValue:Absolute] ||| FindAbsolute [FieldValue:Absolute] ||| 1.0 -// e.g. "1980s" -[TimeSpan:Regular] ||| [FieldValue:Year] s ||| FindEnclosing ( TimeSpan FindAbsolute [FieldValue:Year] ) DECADES ||| 1.0 -// e.g. "19th century" - requires special handing because, e.g. "19th century" = "18" -[TimeSpan:Regular] ||| [Int] st century ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY [Int] ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| [Int] nd century ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY [Int] ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| [Int] rd century ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY [Int] ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| [Int] th century ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY [Int] ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 - -// ================================= -// expressions of current time spans -// ================================= -[TimeSpan:Regular] ||| now ||| Simple PRESENT ||| 1.0 -[TimeSpan:Regular] ||| today ||| FindEnclosing PRESENT DAYS ||| 1.0 -[TimeSpan:Regular] ||| tonight ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT DAYS ) ( FieldValue NIGHT_OF_DAY 1 ) ||| 1.0 -[TimeSpan:AllowsThis] ||| same day ||| FindEnclosing PRESENT DAYS ||| 1.0 -[TimeSpan:Regular] ||| the [Unit:Singular] ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -[TimeSpan:Regular] ||| this [Unit:Singular] ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -[TimeSpan:Regular] ||| that [Unit:Singular] ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -// e.g. "the current week" -[TimeSpan:Regular] ||| current [Unit:Singular] ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -// e.g. "this evening" -[TimeSpan:Regular] ||| this [FieldValue:Partial] ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT [FieldValue:Partial] ) [FieldValue:Partial] ||| 1.0 -// e.g. "January this year" -[TimeSpan:Regular] ||| [FieldValue:Partial] this [Unit] ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT [Unit] ) [FieldValue:Partial] ||| 1.0 - -// ================================= -// expressions of earlier time spans -// ================================= -[TimeSpan:Regular] ||| yesterday ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 1 DAYS ) ||| 1.0 -// e.g. "last October" -[TimeSpan:AllowsThis] ||| last [FieldValue:Partial] ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| past [FieldValue:Partial] ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| previous [FieldValue:Partial] ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -// e.g. "the last three weeks", "almost four years ago" -[TimeSpan:AllowsThis] ||| last [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| past [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| preceding [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| latest [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -// e.g. "three years earlier" -[TimeSpan:Regular] ||| [Period] earlier ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:Regular] ||| [Period] ago ||| MoveEarlier ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -// alternate interpretation: exactly [Period] earlier -[TimeSpan:AllowsThis] ||| last [Period] ||| MoveEarlier PRESENT [Period] ||| 1.0 -[TimeSpan:Regular] ||| [Period] earlier ||| MoveEarlier PRESENT [Period] ||| 1.0 -[TimeSpan:Regular] ||| [Period] ago ||| MoveEarlier PRESENT [Period] ||| 1.0 -// e.g. "the day before last Tuesday" -[TimeSpan:Regular] ||| [Period] before [TimeSpan:Regular] ||| EndAtStartOf ( TimeSpan FindEnclosing [TimeSpan:Regular] [Period] ) [Period] ||| 1.0 -// e.g. "January last year" -[TimeSpan:Regular] ||| [FieldValue:Partial] last [Unit] ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -// e.g. "the year-ago third quarter" -[TimeSpan:Regular] ||| [Period] ago [FieldValue:Partial] ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [Period] earlier [FieldValue:Partial] ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 - -// =============================== -// expressions of later time spans -// =============================== -[TimeSpan:Regular] ||| tomorrow ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 1 DAYS ) ||| 1.0 -// e.g. "next Tuesday" -[TimeSpan:AllowsThis] ||| next [FieldValue:Partial] ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| coming [FieldValue:Partial] ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| following [FieldValue:Partial] ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -// e.g. "next year" -[TimeSpan:AllowsThis] ||| next [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| following [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| coming [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -// e.g. "January next year" -[TimeSpan:Regular] ||| [FieldValue:Partial] next [Unit] ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 - -// ==================================================================================== -// allows rules tagged with :AllowsThis to be prefixed by "this" or "that" (or nothing) -// ==================================================================================== -[TimeSpan:Regular] ||| [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| this [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| that [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 - -// ========================================== -// expressions that could be earlier or later -// ========================================== -// e.g. "Friday", "the weekend", "October 11" -[TimeSpan:Regular] ||| [FieldValue:Partial] ||| FindAtOrEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 - -// ======================================================================== -// expressions that could be earlier or later (but we assume to be earlier) -// ======================================================================== -[TimeSpan:Regular] ||| twenties ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 2 ) ||| 1.0 -[TimeSpan:Regular] ||| thirties ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 3 ) ||| 1.0 -[TimeSpan:Regular] ||| forties ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 4 ) ||| 1.0 -[TimeSpan:Regular] ||| fifties ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 5 ) ||| 1.0 -[TimeSpan:Regular] ||| sixties ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 6 ) ||| 1.0 -[TimeSpan:Regular] ||| seventies ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 7 ) ||| 1.0 -[TimeSpan:Regular] ||| eighties ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 8 ) ||| 1.0 -[TimeSpan:Regular] ||| nineties ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 9 ) ||| 1.0 - -// ========================================== -// expressions changing time span granularity -// ========================================== -// e.g. "the week of March 6" -[TimeSpan:Regular] ||| [Unit:Singular] of [TimeSpan:Regular] ||| FindEnclosing [TimeSpan:Regular] [Unit:Singular] ||| 1.0 -// e.g. "the quarter a year ago", "the period last year" -[TimeSpan:Regular] ||| [Unit:Singular] [TimeSpan:Regular] ||| FindEnclosing [TimeSpan:Regular] [Unit:Singular] ||| 1.0 -// e.g. "Thanksgiving day" -[TimeSpan:Regular] ||| [TimeSpan:Regular] [Unit:Singular] ||| FindEnclosing [TimeSpan:Regular] [Unit:Singular] ||| 1.0 -// e.g. "mid-afternoon yesterday" -[TimeSpan:Regular] ||| [FieldValue:PartOfDay] [TimeSpan:Regular] ||| FindEnclosed [TimeSpan:Regular] [FieldValue:PartOfDay] ||| 1.0 -// e.g. "winter of 1994" -[TimeSpan:Regular] ||| [FieldValue:Partial] of [TimeSpan:Regular] ||| FindEnclosed [TimeSpan:Regular] [FieldValue:Partial] ||| 1.0 -// e.g. "this year's third quarter" -[TimeSpan:Regular] ||| [TimeSpan:Regular] ' s [FieldValue:Partial] ||| FindEnclosed [TimeSpan:Regular] [FieldValue:Partial] ||| 1.0 - -// ======================================== -// expressions that set time span modifiers -// ======================================== -[TimeSpan:Regular] ||| end of [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) END ||| 1.0 -[TimeSpan:Regular] ||| [Unit] end ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) END ||| 1.0 -[TimeSpan:Regular] ||| start of [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| beginning of [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| early [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -// don't allow this to combine with other rules, since "earlier" can play many roles -[TimeSpan:Solo] ||| earlier [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| earlier in [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| mid [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] MID ||| 1.0 -[TimeSpan:Regular] ||| middle of [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] MID ||| 1.0 -[TimeSpan:Regular] ||| late [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 -[TimeSpan:Regular] ||| later [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 -[TimeSpan:Regular] ||| later in [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 -[TimeSpan:Regular] ||| end of [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 -[TimeSpan:Regular] ||| almost [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| about [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| around [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| part of [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| post [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] AFTER ||| 1.0 -[TimeSpan:Regular] ||| [TimeSpan:Regular] or later ||| WithModifier [TimeSpan:Regular] ON_OR_AFTER ||| 1.0 -[TimeSpan:Regular] ||| [TimeSpan:Regular] and beyond ||| WithModifier [TimeSpan:Regular] ON_OR_AFTER ||| 1.0 -[TimeSpan:Regular] ||| [TimeSpan:Regular] or earlier ||| WithModifier [TimeSpan:Regular] ON_OR_BEFORE ||| 1.0 -[TimeSpan:Regular] ||| [TimeSpan:Regular] and before ||| WithModifier [TimeSpan:Regular] ON_OR_BEFORE ||| 1.0 - -// ================================================= -// expressions of fields used only by time span sets -// ================================================= -[FieldValue:Unspecified] ||| mornings ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| afternoons ||| AFTERNOON_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| evenings ||| EVENING_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| nights ||| NIGHT_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| springs ||| SPRING_OF_YEAR 1 ||| 1.0 -[FieldValue:Unspecified] ||| summers ||| SUMMER_OF_YEAR 1 ||| 1.0 -[FieldValue:Unspecified] ||| falls ||| FALL_OF_YEAR 1 ||| 1.0 -[FieldValue:Unspecified] ||| autumns ||| FALL_OF_YEAR 1 ||| 1.0 -[FieldValue:Unspecified] ||| winters ||| WINTER_OF_YEAR 1 ||| 1.0 -[FieldValue:Unspecified] ||| first quarters ||| QUARTER_OF_YEAR 1 ||| 1.0 -[FieldValue:Unspecified] ||| second quarters ||| QUARTER_OF_YEAR 2 ||| 1.0 -[FieldValue:Unspecified] ||| third quarters ||| QUARTER_OF_YEAR 3 ||| 1.0 -[FieldValue:Unspecified] ||| fourth quarters ||| QUARTER_OF_YEAR 4 ||| 1.0 - -// ============================= -// expressions of time span sets -// ============================= -// e.g. "each Thursday" -[TimeSpanSet] ||| each [FieldValue:Partial] ||| Simple [FieldValue:Partial] ||| 1.0 -// e.g. "Tuesday nights" -[TimeSpanSet] ||| [FieldValue:Partial] [FieldValue:Unspecified] ||| Simple ( FieldValue [FieldValue:Partial] [FieldValue:Unspecified] ) ||| 1.0 -// e.g. "the past three summers" -[TimeSpanSet] ||| past [Int] [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -// e.g. "fourth quarters" -[TimeSpanSet] ||| [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 diff --git a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/en.numbers.grammar b/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/en.numbers.grammar deleted file mode 100755 index 0e529c0..0000000 --- a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/en.numbers.grammar +++ /dev/null @@ -1,63 +0,0 @@ -ROOTS [Int:UpTo15Digit] - -[Nil] ||| a ||| ||| 1.0 -[Nil] ||| and ||| ||| 1.0 -[Int:1Digit] ||| one ||| 1 ||| 1.0 -[Int:1Digit] ||| two ||| 2 ||| 1.0 -[Int:1Digit] ||| three ||| 3 ||| 1.0 -[Int:1Digit] ||| four ||| 4 ||| 1.0 -[Int:1Digit] ||| five ||| 5 ||| 1.0 -[Int:1Digit] ||| six ||| 6 ||| 1.0 -[Int:1Digit] ||| seven ||| 7 ||| 1.0 -[Int:1Digit] ||| eight ||| 8 ||| 1.0 -[Int:1Digit] ||| nine ||| 9 ||| 1.0 -[Int:Teens] ||| ten ||| 1 0 ||| 1.0 -[Int:Teens] ||| eleven ||| 1 1 ||| 1.0 -[Int:Teens] ||| twelve ||| 1 2 ||| 1.0 -[Int:Teens] ||| thirteen ||| 1 3 ||| 1.0 -[Int:Teens] ||| fourteen ||| 1 4 ||| 1.0 -[Int:Teens] ||| fifteen ||| 1 5 ||| 1.0 -[Int:Teens] ||| sixteen ||| 1 6 ||| 1.0 -[Int:Teens] ||| seventeen ||| 1 7 ||| 1.0 -[Int:Teens] ||| eighteen ||| 1 8 ||| 1.0 -[Int:Teens] ||| nineteen ||| 1 9 ||| 1.0 -[Int:Tens] ||| twenty ||| 2 ||| 1.0 -[Int:Tens] ||| thirty ||| 3 ||| 1.0 -[Int:Tens] ||| forty ||| 4 ||| 1.0 -[Int:Tens] ||| fifty ||| 5 ||| 1.0 -[Int:Tens] ||| sixty ||| 6 ||| 1.0 -[Int:Tens] ||| seventy ||| 7 ||| 1.0 -[Int:Tens] ||| eighty ||| 8 ||| 1.0 -[Int:Tens] ||| ninety ||| 9 ||| 1.0 -[Int:2Digit] ||| [Int:Teens] ||| [Int:Teens] ||| 1.0 -[Int:2Digit] ||| [Int:Tens] ||| [Int:Tens] 0 ||| 1.0 -[Int:2Digit] ||| [Int:Tens] [Int:1Digit] ||| [Int:Tens] [Int:1Digit] ||| 1.0 -[Int:UpTo2Digit] ||| [Int:2Digit] ||| [Int:2Digit] ||| 1.0 -[Int:UpTo2Digit] ||| [Int:1Digit] ||| 0 [Int:1Digit] ||| 1.0 -[Int:Hundred] ||| hundred ||| 0 0 ||| 1.0 -[Int:Hundred] ||| hundred [Int:UpTo2Digit] ||| [Int:UpTo2Digit] ||| 1.0 -[Int:UpTo3Digit] ||| [Int:Hundred] ||| 1 [Int:Hundred] ||| 1.0 -[Int:UpTo3Digit] ||| [Int:1Digit] [Int:Hundred] ||| [Int:1Digit] [Int:Hundred] ||| 1.0 -[Int:UpTo3Digit] ||| [Int:UpTo2Digit] ||| 0 [Int:UpTo2Digit] ||| 1.0 -[Int:Thousand] ||| thousand ||| 0 0 0 ||| 1.0 -[Int:Thousand] ||| thousand [Int:UpTo3Digit] ||| [Int:UpTo3Digit] ||| 1.0 -[Int:UpTo6Digit] ||| [Int:UpTo3Digit] ||| 0 0 0 [Int:UpTo3Digit] ||| 1.0 -[Int:UpTo6Digit] ||| [Int:Thousand] ||| 0 0 1 [Int:Thousand] ||| 1.0 -[Int:UpTo6Digit] ||| [Int:2Digit] [Int:Hundred] ||| 0 0 [Int:2Digit] [Int:Hundred] ||| 1.0 -[Int:UpTo6Digit] ||| [Int:2Digit,1] [Int:2Digit,2] ||| 0 0 [Int:2Digit,1] [Int:2Digit,2] ||| 1.0 -[Int:UpTo6Digit] ||| [Int:UpTo3Digit] [Int:Thousand] ||| [Int:UpTo3Digit] [Int:Thousand] ||| 1.0 -[Int:Million] ||| million ||| 0 0 0 0 0 0 ||| 1.0 -[Int:Million] ||| million [Int:UpTo6Digit] ||| [Int:UpTo6Digit] ||| 1.0 -[Int:UpTo9Digit] ||| [Int:Million] ||| 0 0 1 [Int:Million] ||| 1.0 -[Int:UpTo9Digit] ||| [Int:UpTo3Digit] [Int:Million] ||| [Int:UpTo3Digit] [Int:Million] ||| 1.0 -[Int:UpTo9Digit] ||| [Int:UpTo6Digit] ||| 0 0 0 [Int:UpTo6Digit] ||| 1.0 -[Int:Billion] ||| billion ||| 0 0 0 0 0 0 0 0 0 ||| 1.0 -[Int:Billion] ||| billion [Int:UpTo9Digit] ||| [Int:UpTo9Digit] ||| 1.0 -[Int:UpTo12Digit] ||| [Int:Billion] ||| 0 0 1 [Int:Billion] ||| 1.0 -[Int:UpTo12Digit] ||| [Int:UpTo3Digit] [Int:Billion] ||| [Int:UpTo3Digit] [Int:Billion] ||| 1.0 -[Int:UpTo12Digit] ||| [Int:UpTo9Digit] ||| [Int:UpTo9Digit] ||| 1.0 -[Int:Trillion] ||| trillion ||| 0 0 0 0 0 0 0 0 0 0 0 0 ||| 1.0 -[Int:Trillion] ||| trillion [Int:UpTo12Digit] ||| 0 0 0 [Int:UpTo12Digit] ||| 1.0 -[Int:UpTo15Digit] ||| [Int:Trillion] ||| 0 0 1 [Int:Trillion] ||| 1.0 -[Int:UpTo15Digit] ||| [Int:UpTo3Digit] [Int:Trillion] ||| [Int:UpTo3Digit] [Int:Trillion] ||| 1.0 -[Int:UpTo15Digit] ||| [Int:UpTo12Digit] ||| [Int:UpTo12Digit] ||| 1.0 diff --git a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/es.grammar b/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/es.grammar deleted file mode 100755 index e2061b1..0000000 --- a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/es.grammar +++ /dev/null @@ -1,1119 +0,0 @@ -ROOTS [Period] [PeriodSet] [TimeSpan] [TimeSpanSet] - -// ========================================================================= -// 1. Formas que se pueden pasar por alto // Expressions that can be ignored -// ========================================================================= -[Nil] ||| un ||| ||| 1.0 -// [Nil] ||| una ||| ||| 1.0 -[Nil] ||| el ||| ||| 1.0 -[Nil] ||| la ||| ||| 1.0 -[Nil] ||| los ||| ||| 1.0 -[Nil] ||| las ||| ||| 1.0 -[Nil] ||| a ||| ||| 1.0 -[Nil] ||| al ||| ||| 1.0 -[Nil] ||| de ||| ||| 1.0 -[Nil] ||| del ||| ||| 1.0 -[Nil] ||| en ||| ||| 1.0 -[Nil] ||| mismo ||| ||| 1.0 -[Nil] ||| misma ||| ||| 1.0 -[Nil] ||| más ||| ||| 1.0 -[Nil] ||| . ||| ||| 1.0 -[Nil] ||| - ||| ||| 1.0 -[Nil] ||| / ||| ||| 1.0 - -// ============================== -// 2. Números enteros // Integers -// ============================== -[Int:1Digit] ||| un ||| 1 ||| 1.0 -[Int:1Digit] ||| uno ||| 1 ||| 1.0 -[Int:1Digit] ||| una ||| 1 ||| 1.0 -[Int:1Digit] ||| dos ||| 2 ||| 1.0 -[Int:1Digit] ||| tres ||| 3 ||| 1.0 -[Int:1Digit] ||| cuatro ||| 4 ||| 1.0 -[Int:1Digit] ||| cinco ||| 5 ||| 1.0 -[Int:1Digit] ||| seis ||| 6 ||| 1.0 -[Int:1Digit] ||| siete ||| 7 ||| 1.0 -[Int:1Digit] ||| ocho ||| 8 ||| 1.0 -[Int:1Digit] ||| nueve ||| 9 ||| 1.0 - -[Int:Teens] ||| diez ||| 1 0 ||| 1.0 -[Int:Teens] ||| once ||| 1 1 ||| 1.0 -[Int:Teens] ||| doce ||| 1 2 ||| 1.0 -[Int:Teens] ||| trece ||| 1 3 ||| 1.0 -[Int:Teens] ||| catorce ||| 1 4 ||| 1.0 -[Int:Teens] ||| quince ||| 1 5 ||| 1.0 -[Int:Teens] ||| dieciséis ||| 1 6 ||| 1.0 -[Int:Teens] ||| diecisiete ||| 1 7 ||| 1.0 -[Int:Teens] ||| dieciocho ||| 1 8 ||| 1.0 -[Int:Teens] ||| diecinueve ||| 1 9 ||| 1.0 -[Int:Twenties] ||| veinte ||| 2 0 ||| 1.0 -[Int:Twenties] ||| veintiún ||| 2 1 ||| 1.0 -[Int:Twenties] ||| veintiuno ||| 2 1 ||| 1.0 -[Int:Twenties] ||| veintiuna ||| 2 1 ||| 1.0 -[Int:Twenties] ||| veintidós ||| 2 2 ||| 1.0 -[Int:Twenties] ||| veintitrés ||| 2 3 ||| 1.0 -[Int:Twenties] ||| veinticuatro ||| 2 4 ||| 1.0 -[Int:Twenties] ||| veinticinco ||| 2 5 ||| 1.0 -[Int:Twenties] ||| veintiséis ||| 2 6 ||| 1.0 -[Int:Twenties] ||| veintisiete ||| 2 7 ||| 1.0 -[Int:Twenties] ||| veintiocho ||| 2 8 ||| 1.0 -[Int:Twenties] ||| veintinueve ||| 2 9 ||| 1.0 -[Int:Tens] ||| treinta ||| 3 ||| 1.0 -[Int:Tens] ||| cuarenta ||| 4 ||| 1.0 -[Int:Tens] ||| cincuenta ||| 5 ||| 1.0 -[Int:Tens] ||| sesenta ||| 6 ||| 1.0 -[Int:Tens] ||| setenta ||| 7 ||| 1.0 -[Int:Tens] ||| ochenta ||| 8 ||| 1.0 -[Int:Tens] ||| noventa ||| 9 ||| 1.0 -[Int:2Digit] ||| [Int:Teens] ||| [Int:Teens] ||| 1.0 -[Int:2Digit] ||| [Int:Twenties] ||| [Int:Twenties] ||| 1.0 -[Int:2Digit] ||| [Int:Tens] ||| [Int:Tens] 0 ||| 1.0 -[Int:2Digit] ||| [Int:Tens] y [Int:1Digit] ||| [Int:Tens] [Int:1Digit] ||| 1.0 - -[Int:OneHundred] ||| cien ||| 1 0 0 ||| 1.0 -[Int:OneHundreds] ||| ciento ||| 1 ||| 1.0 -[Int:Hundreds] ||| doscientos ||| 2 ||| 1.0 -[Int:Hundreds] ||| doscientas ||| 2 ||| 1.0 -[Int:Hundreds] ||| trescientos ||| 3 ||| 1.0 -[Int:Hundreds] ||| trescientas ||| 3 ||| 1.0 -[Int:Hundreds] ||| cuatrocientos ||| 4 ||| 1.0 -[Int:Hundreds] ||| cuatrocientas ||| 4 ||| 1.0 -[Int:Hundreds] ||| quinientos ||| 5 ||| 1.0 -[Int:Hundreds] ||| quinientas ||| 5 ||| 1.0 -[Int:Hundreds] ||| seiscientos ||| 6 ||| 1.0 -[Int:Hundreds] ||| seiscientas ||| 6 ||| 1.0 -[Int:Hundreds] ||| setecientos ||| 7 ||| 1.0 -[Int:Hundreds] ||| setecientas ||| 7 ||| 1.0 -[Int:Hundreds] ||| ochocientos ||| 8 ||| 1.0 -[Int:Hundreds] ||| ochocientas ||| 8 ||| 1.0 -[Int:Hundreds] ||| novecientos ||| 9 ||| 1.0 -[Int:Hundreds] ||| novecientas ||| 9 ||| 1.0 -[Int:3Digit] ||| [Int:OneHundred] ||| [Int:OneHundred] ||| 1.0 -[Int:3Digit] ||| [Int:Hundreds] ||| [Int:Hundreds] 0 0 ||| 1.0 -[Int:3Digit] ||| [Int:OneHundreds] [Int:1Digit] ||| [Int:OneHundreds] 0 [Int:1Digit] ||| 1.0 -[Int:3Digit] ||| [Int:Hundreds] [Int:1Digit] ||| [Int:Hundreds] 0 [Int:1Digit] ||| 1.0 -[Int:3Digit] ||| [Int:OneHundreds] [Int:2Digit] ||| [Int:OneHundreds] [Int:2Digit] ||| 1.0 -[Int:3Digit] ||| [Int:Hundreds] [Int:2Digit] ||| [Int:Hundreds] [Int:2Digit] ||| 1.0 - -[Int:Thousand3Digit] ||| mil ||| 0 0 0 ||| 1.0 -[Int:Thousand3Digit] ||| mil [Int:1Digit] ||| 0 0 [Int:1Digit] ||| 1.0 -[Int:Thousand3Digit] ||| mil [Int:2Digit] ||| 0 [Int:2Digit] ||| 1.0 -[Int:Thousand3Digit] ||| mil [Int:3Digit] ||| [Int:3Digit] ||| 1.0 -[Int:4Digit] ||| [Int:Thousand3Digit] ||| 1 [Int:Thousand3Digit] ||| 1.0 -[Int:4Digit] ||| [Int:1Digit] [Int:Thousand3Digit] ||| [Int:1Digit] [Int:Thousand3Digit] ||| 1.0 -[Int] ||| [Int:1Digit] ||| [Int:1Digit] ||| 1.0 -[Int] ||| [Int:2Digit] ||| [Int:2Digit] ||| 1.0 -[Int] ||| [Int:3Digit] ||| [Int:3Digit] ||| 1.0 -[Int] ||| [Int:4Digit] ||| [Int:4Digit] ||| 1.0 - -// Otras expresiones referidas a números enteros -[Int] ||| par ||| 2 ||| 1.0 - -// ======================================= -// 3. Unidades de tiempo // Temporal units -// ======================================= -[Unit:Singular] ||| segundo ||| SECONDS ||| 1.0 -[Unit:Singular] ||| minuto ||| MINUTES ||| 1.0 -[Unit:Singular] ||| hora ||| HOURS ||| 1.0 -[Unit:Singular] ||| día ||| DAYS ||| 1.0 -[Unit:Singular] ||| jornada ||| DAYS ||| 1.0 -[Unit:Singular] ||| semana ||| WEEKS ||| 1.0 -[Unit:Singular] ||| mes ||| MONTHS ||| 1.0 -[Unit:Singular] ||| trimestre ||| QUARTER_YEARS ||| 1.0 -[Unit:Singular] ||| año ||| YEARS ||| 1.0 -[Unit:Singular] ||| temporada ||| YEARS ||| 1.0 -[Unit:Singular] ||| década ||| DECADES ||| 1.0 -[Unit:Singular] ||| decenio ||| DECADES ||| 1.0 -[Unit:Singular] ||| siglo ||| CENTURIES ||| 1.0 -[Unit] ||| [Unit:Singular] ||| [Unit:Singular] ||| 1.0 - -[Unit:Plural] ||| segundos ||| SECONDS ||| 1.0 -[Unit:Plural] ||| minutos ||| MINUTES ||| 1.0 -[Unit:Plural] ||| horas ||| HOURS ||| 1.0 -[Unit:Plural] ||| días ||| DAYS ||| 1.0 -[Unit:Plural] ||| jornadas ||| DAYS ||| 1.0 -[Unit:Plural] ||| semanas ||| WEEKS ||| 1.0 -[Unit:Plural] ||| meses ||| MONTHS ||| 1.0 -[Unit:Plural] ||| trimestres ||| QUARTER_YEARS ||| 1.0 -[Unit:Plural] ||| años ||| YEARS ||| 1.0 -[Unit:Plural] ||| temporadas ||| YEARS ||| 1.0 -[Unit:Plural] ||| décadas ||| DECADES ||| 1.0 -[Unit:Plural] ||| decenios ||| DECADES ||| 1.0 -[Unit:Plural] ||| siglos ||| CENTURIES ||| 1.0 -[Unit] ||| [Unit:Plural] ||| [Unit:Plural] ||| 1.0 - -// =================================== -// 4. Partes del día // Parts of a day -// =================================== -[FieldValue:HourOfDay] ||| [Int:0-23] ||| HOUR_OF_DAY [Int:0-23] ||| 1.0 -[FieldValue:HourOfDay] ||| 24 ||| HOUR_OF_DAY 0 ||| 1.0 -[FieldValue:HourOfDay] ||| [Int:1Digit] ||| HOUR_OF_DAY [Int:1Digit] ||| 1.0 -[FieldValue:HourOfDay] ||| [Int:2Digit] ||| HOUR_OF_DAY [Int:2Digit] ||| 1.0 -[FieldValue:HourOfAMPM] ||| [Int:1-12] ||| HOUR_OF_AMPM [Int:1-12] ||| 1.0 -[FieldValue:HourOfAMPM] ||| [Int:1Digit] ||| HOUR_OF_AMPM [Int:1Digit] ||| 1.0 -[FieldValue:HourOfAMPM] ||| [Int:Teens] ||| HOUR_OF_AMPM [Int:Teens] ||| 1.0 -[FieldValue:MinuteOfHour] ||| [Int:0-59] ||| MINUTE_OF_HOUR [Int:0-59] ||| 1.0 -[FieldValue:MinuteOfHour] ||| [Int:1Digit] ||| MINUTE_OF_HOUR [Int:1Digit] ||| 1.0 -[FieldValue:MinuteOfHour] ||| [Int:2Digit] ||| MINUTE_OF_HOUR [Int:2Digit] ||| 1.0 -[FieldValue:MinuteOfHour] ||| cuarto ||| MINUTE_OF_HOUR 15 ||| 1.0 -[FieldValue:MinuteOfHour] ||| media ||| MINUTE_OF_HOUR 30 ||| 1.0 -[FieldValue:SecondOfMinute] ||| [Int:0-59] ||| SECOND_OF_MINUTE [Int:0-59] ||| 1.0 - -[FieldValue:AMPMOfDay] ||| a . m ||| AMPM_OF_DAY 0 ||| 1.0 -[FieldValue:AMPMOfDay] ||| am ||| AMPM_OF_DAY 0 ||| 1.0 -[FieldValue:AMPMOfDay] ||| de la madrugada ||| AMPM_OF_DAY 0 ||| 1.0 -[FieldValue:AMPMOfDay] ||| de la mañana ||| AMPM_OF_DAY 0 ||| 1.0 -[FieldValue:AMPMOfDay] ||| p . m ||| AMPM_OF_DAY 1 ||| 1.0 -[FieldValue:AMPMOfDay] ||| pm ||| AMPM_OF_DAY 1 ||| 1.0 -[FieldValue:AMPMOfDay] ||| del mediodía ||| AMPM_OF_DAY 1 ||| 1.0 -[FieldValue:AMPMOfDay] ||| de la tarde ||| AMPM_OF_DAY 1 ||| 1.0 -[FieldValue:AMPMOfDay] ||| de la noche ||| AMPM_OF_DAY 1 ||| 1.0 - -[FieldValue:PartOfDay] ||| alba ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| madrugada ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| la mañana ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| una mañana ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| esta mañana ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| matinal ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| matinales ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| mediodía ||| AFTERNOON_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| tarde ||| AFTERNOON_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| vespertino ||| AFTERNOON_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| vespertina ||| AFTERNOON_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| vespertinos ||| AFTERNOON_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| vespertinas ||| AFTERNOON_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| noche ||| NIGHT_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| nocturno ||| NIGHT_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| nocturna ||| NIGHT_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| nocturnos ||| NIGHT_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| nocturnas ||| NIGHT_OF_DAY 1 ||| 1.0 - -// =============================== -// 5. Hora del día // Time of day -// =============================== -[FieldValue:Time] ||| mediodía ||| ( FieldValue:HourOfDay HOUR_OF_DAY 12 ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| medianoche ||| ( FieldValue:HourOfDay HOUR_OF_DAY 0 ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 - -[FieldValue:Time] ||| [FieldValue:HourOfDay] : [FieldValue:MinuteOfHour] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] ||| 1.0 -[FieldValue:Time] ||| [FieldValue:HourOfDay] . [FieldValue:MinuteOfHour] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] ||| 1.0 -[FieldValue:Time] ||| [FieldValue:HourOfDay] y [FieldValue:MinuteOfHour] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] ||| 1.0 -[FieldValue:Time] ||| [FieldValue:HourOfDay] : [FieldValue:MinuteOfHour] : [FieldValue:SecondOfMinute] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] [FieldValue:SecondOfMinute] ||| 1.0 -[FieldValue:Time] ||| [FieldValue:HourOfAMPM] : [FieldValue:MinuteOfHour] [FieldValue:AMPMOfDay] ||| [FieldValue:HourOfAMPM] [FieldValue:MinuteOfHour] [FieldValue:AMPMOfDay] ||| 1.0 -[FieldValue:Time] ||| [FieldValue:HourOfAMPM] y [FieldValue:MinuteOfHour] [FieldValue:AMPMOfDay] ||| [FieldValue:HourOfAMPM] [FieldValue:MinuteOfHour] [FieldValue:AMPMOfDay] ||| 1.0 -[FieldValue:Time] ||| [FieldValue:HourOfAMPM] [FieldValue:AMPMOfDay] ||| [FieldValue:HourOfAMPM] ( FieldValue MINUTE_OF_HOUR 0 ) [FieldValue:AMPMOfDay] ||| 1.0 - -[FieldValue:Time] ||| [FieldValue:HourOfDay] h ||| [FieldValue:HourOfDay] ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| la [FieldValue:HourOfDay] ||| [FieldValue:HourOfDay] ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| las [FieldValue:HourOfDay] ||| [FieldValue:HourOfDay] ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 - -[FieldValue:Time] ||| [FieldValue:Time] horas ||| [FieldValue:Time] ||| 1.0 -[FieldValue:Time] ||| [FieldValue:Time] hora local ||| [FieldValue:Time] ||| 1.0 -[FieldValue:Time] ||| [FieldValue:Time] gmt ||| [FieldValue:Time] ||| 1.0 - -// ======================================== -// 6. Días de la semana // Days of the week -// ======================================== -[FieldValue:DayOfWeek] ||| lunes ||| DAY_OF_WEEK 1 ||| 1.0 -[FieldValue:DayOfWeek] ||| martes ||| DAY_OF_WEEK 2 ||| 1.0 -[FieldValue:DayOfWeek] ||| miércoles ||| DAY_OF_WEEK 3 ||| 1.0 -[FieldValue:DayOfWeek] ||| jueves ||| DAY_OF_WEEK 4 ||| 1.0 -[FieldValue:DayOfWeek] ||| viernes ||| DAY_OF_WEEK 5 ||| 1.0 -[FieldValue:DayOfWeek] ||| sábado ||| DAY_OF_WEEK 6 ||| 1.0 -[FieldValue:DayOfWeek] ||| domingo ||| DAY_OF_WEEK 7 ||| 1.0 - -[FieldValue:DayOfWeek] ||| lun ||| DAY_OF_WEEK 1 ||| 1.0 -[FieldValue:DayOfWeek] ||| lu ||| DAY_OF_WEEK 1 ||| 1.0 -[FieldValue:DayOfWeek] ||| l ||| DAY_OF_WEEK 1 ||| 1.0 -[FieldValue:DayOfWeek] ||| mar ||| DAY_OF_WEEK 2 ||| 1.0 -[FieldValue:DayOfWeek] ||| ma ||| DAY_OF_WEEK 2 ||| 1.0 -[FieldValue:DayOfWeek] ||| m ||| DAY_OF_WEEK 2 ||| 1.0 -[FieldValue:DayOfWeek] ||| mié ||| DAY_OF_WEEK 3 ||| 1.0 -[FieldValue:DayOfWeek] ||| mi ||| DAY_OF_WEEK 3 ||| 1.0 -[FieldValue:DayOfWeek] ||| x ||| DAY_OF_WEEK 3 ||| 1.0 -[FieldValue:DayOfWeek] ||| jue ||| DAY_OF_WEEK 4 ||| 1.0 -[FieldValue:DayOfWeek] ||| ju ||| DAY_OF_WEEK 4 ||| 1.0 -[FieldValue:DayOfWeek] ||| j ||| DAY_OF_WEEK 4 ||| 1.0 -[FieldValue:DayOfWeek] ||| vie ||| DAY_OF_WEEK 5 ||| 1.0 -[FieldValue:DayOfWeek] ||| vi ||| DAY_OF_WEEK 5 ||| 1.0 -[FieldValue:DayOfWeek] ||| v ||| DAY_OF_WEEK 5 ||| 1.0 -[FieldValue:DayOfWeek] ||| sáb ||| DAY_OF_WEEK 6 ||| 1.0 -[FieldValue:DayOfWeek] ||| sa ||| DAY_OF_WEEK 6 ||| 1.0 -[FieldValue:DayOfWeek] ||| s ||| DAY_OF_WEEK 6 ||| 1.0 -[FieldValue:DayOfWeek] ||| dom ||| DAY_OF_WEEK 7 ||| 1.0 -[FieldValue:DayOfWeek] ||| do ||| DAY_OF_WEEK 7 ||| 1.0 -[FieldValue:DayOfWeek] ||| d ||| DAY_OF_WEEK 7 ||| 1.0 - -// ===================================== -// 7. Fin de semana // Weekend of a week -// ===================================== -[FieldValue:WeekendOfWeek] ||| fin de semana ||| WEEKEND_OF_WEEK 1 ||| 1.0 - -// ================================== -// 8. Días del mes // Days of a month -// ================================== -[FieldValue:OrdinalDayOfMonth] ||| primero ||| DAY_OF_MONTH 1 ||| 1.0 -[FieldValue:NumericDayOfMonth] ||| [Int:1-31] ||| DAY_OF_MONTH [Int:1-31] ||| 1.0 -[FieldValue:NumericDayOfMonth] ||| [Int:1Digit] ||| DAY_OF_MONTH [Int:1Digit] ||| 1.0 -[FieldValue:NumericDayOfMonth] ||| [Int:2Digit] ||| DAY_OF_MONTH [Int:2Digit] ||| 1.0 - -// ====================================== -// 9. Meses del año // Months of the year -// ====================================== -[FieldValue:MonthOfYear] ||| enero ||| MONTH_OF_YEAR 1 ||| 1.0 -[FieldValue:MonthOfYear] ||| febrero ||| MONTH_OF_YEAR 2 ||| 1.0 -[FieldValue:MonthOfYear] ||| marzo ||| MONTH_OF_YEAR 3 ||| 1.0 -[FieldValue:MonthOfYear] ||| abril ||| MONTH_OF_YEAR 4 ||| 1.0 -[FieldValue:MonthOfYear] ||| mayo ||| MONTH_OF_YEAR 5 ||| 1.0 -[FieldValue:MonthOfYear] ||| junio ||| MONTH_OF_YEAR 6 ||| 1.0 -[FieldValue:MonthOfYear] ||| julio ||| MONTH_OF_YEAR 7 ||| 1.0 -[FieldValue:MonthOfYear] ||| agosto ||| MONTH_OF_YEAR 8 ||| 1.0 -[FieldValue:MonthOfYear] ||| septiembre ||| MONTH_OF_YEAR 9 ||| 1.0 -[FieldValue:MonthOfYear] ||| setiembre ||| MONTH_OF_YEAR 9 ||| 1.0 -[FieldValue:MonthOfYear] ||| octubre ||| MONTH_OF_YEAR 10 ||| 1.0 -[FieldValue:MonthOfYear] ||| noviembre ||| MONTH_OF_YEAR 11 ||| 1.0 -[FieldValue:MonthOfYear] ||| diciembre ||| MONTH_OF_YEAR 12 ||| 1.0 - -[FieldValue:MonthOfYear] ||| ene ||| MONTH_OF_YEAR 1 ||| 1.0 -[FieldValue:MonthOfYear] ||| en ||| MONTH_OF_YEAR 1 ||| 1.0 -[FieldValue:MonthOfYear] ||| feb ||| MONTH_OF_YEAR 2 ||| 1.0 -[FieldValue:MonthOfYear] ||| febr ||| MONTH_OF_YEAR 2 ||| 1.0 -[FieldValue:MonthOfYear] ||| mar ||| MONTH_OF_YEAR 3 ||| 1.0 -[FieldValue:MonthOfYear] ||| mzo ||| MONTH_OF_YEAR 3 ||| 1.0 -[FieldValue:MonthOfYear] ||| abr ||| MONTH_OF_YEAR 4 ||| 1.0 -[FieldValue:MonthOfYear] ||| may ||| MONTH_OF_YEAR 5 ||| 1.0 -[FieldValue:MonthOfYear] ||| my ||| MONTH_OF_YEAR 5 ||| 1.0 -[FieldValue:MonthOfYear] ||| jun ||| MONTH_OF_YEAR 6 ||| 1.0 -[FieldValue:MonthOfYear] ||| jul ||| MONTH_OF_YEAR 7 ||| 1.0 -[FieldValue:MonthOfYear] ||| ago ||| MONTH_OF_YEAR 8 ||| 1.0 -[FieldValue:MonthOfYear] ||| ag ||| MONTH_OF_YEAR 8 ||| 1.0 -[FieldValue:MonthOfYear] ||| sep ||| MONTH_OF_YEAR 9 ||| 1.0 -[FieldValue:MonthOfYear] ||| set ||| MONTH_OF_YEAR 9 ||| 1.0 -[FieldValue:MonthOfYear] ||| oct ||| MONTH_OF_YEAR 10 ||| 1.0 -[FieldValue:MonthOfYear] ||| nov ||| MONTH_OF_YEAR 11 ||| 1.0 -[FieldValue:MonthOfYear] ||| dic ||| MONTH_OF_YEAR 12 ||| 1.0 - -[FieldValue:NumericMonthOfYear] ||| [Int:1-12] ||| MONTH_OF_YEAR [Int:1-12] ||| 1.0 - -// ===================================================== -// 10. Trimestres del año // Fiscal quarters of the year -// ===================================================== -[FieldValue:QuarterOfYear] ||| primer trimestre ||| QUARTER_OF_YEAR 1 ||| 1.0 -[FieldValue:QuarterOfYear] ||| segundo trimestre ||| QUARTER_OF_YEAR 2 ||| 1.0 -[FieldValue:QuarterOfYear] ||| tercer trimestre ||| QUARTER_OF_YEAR 3 ||| 1.0 -[FieldValue:QuarterOfYear] ||| cuarto trimestre ||| QUARTER_OF_YEAR 4 ||| 1.0 -[FieldValue:QuarterOfYear] ||| último trimestre ||| QUARTER_OF_YEAR 4 ||| 1.0 - -// ============================================= -// 11. Estaciones del año // Seasons of the year -// ============================================= -[FieldValue:SeasonOfYear] ||| primavera ||| SPRING_OF_YEAR 1 ||| 1.0 -[FieldValue:SeasonOfYear] ||| verano ||| SUMMER_OF_YEAR 1 ||| 1.0 -[FieldValue:SeasonOfYear] ||| otoño ||| FALL_OF_YEAR 1 ||| 1.0 -[FieldValue:SeasonOfYear] ||| invierno ||| WINTER_OF_YEAR 1 ||| 1.0 - -// ========================================= -// 13. Días festivos // Specially named days -// ========================================= -[FieldValue:NamedDay] ||| año nuevo ||| ( FieldValue MONTH_OF_YEAR 1 ) ( FieldValue DAY_OF_MONTH 1 ) ||| 1.0 -[FieldValue:NamedDay] ||| reyes ||| ( FieldValue MONTH_OF_YEAR 1 ) ( FieldValue DAY_OF_MONTH 6 ) ||| 1.0 -[FieldValue:NamedDay] ||| día del padre ||| ( FieldValue MONTH_OF_YEAR 3 ) ( FieldValue DAY_OF_MONTH 19 ) ||| 1.0 -[FieldValue:NamedDay] ||| pascua ||| EASTER_DAY_OF_YEAR 1 ||| 1.0 -[FieldValue:NamedDay] ||| día de la madre ||| ( FieldValue DAY_OF_WEEK 7 ) ( FieldValue MONTH_OF_YEAR 5 ) ( FieldValue ALIGNED_WEEK_OF_MONTH 1 ) ||| 1.0 -[FieldValue:NamedDay] ||| halloween ||| ( FieldValue MONTH_OF_YEAR 10 ) ( FieldValue DAY_OF_MONTH 31 ) ||| 1.0 -[FieldValue:NamedDay] ||| todos los santos ||| ( FieldValue MONTH_OF_YEAR 11 ) ( FieldValue DAY_OF_MONTH 1 ) ||| 1.0 -[FieldValue:NamedDay] ||| nochebuena ||| ( FieldValue MONTH_OF_YEAR 12 ) ( FieldValue DAY_OF_MONTH 24 ) ||| 1.0 -[FieldValue:NamedDay] ||| navidad ||| ( FieldValue MONTH_OF_YEAR 12 ) ( FieldValue DAY_OF_MONTH 25 ) ||| 1.0 -[FieldValue:NamedDay] ||| nochevieja ||| ( FieldValue MONTH_OF_YEAR 12 ) ( FieldValue DAY_OF_MONTH 31 ) ||| 1.0 -[FieldValue:NamedDay] ||| fin de año ||| ( FieldValue MONTH_OF_YEAR 12 ) ( FieldValue DAY_OF_MONTH 31 ) ||| 1.0 - -// ============================== -// 14. Día y mes // Month and day -// ============================== -[FieldValue:MonthDay] ||| [FieldValue:NamedDay] ||| [FieldValue:NamedDay] ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:DayOfWeek] ||| [FieldValue:DayOfWeek] ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:DayOfWeek] [Int:0-31] ||| DAY_OF_MONTH [Int:0-31] ||| 1.0 -[FieldValue:MonthDay] ||| el [Int:0-31] ||| DAY_OF_MONTH [Int:0-31] ||| 1.0 -[FieldValue:MonthDay] ||| al [Int:0-31] ||| DAY_OF_MONTH [Int:0-31] ||| 1.0 -[FieldValue:MonthDay] ||| del [Int:0-31] ||| DAY_OF_MONTH [Int:0-31] ||| 1.0 -[FieldValue:MonthDay] ||| día [Int:0-31] ||| DAY_OF_MONTH [Int:0-31] ||| 1.0 - -[FieldValue:MonthDay] ||| [FieldValue:OrdinalDayOfMonth] [FieldValue:MonthOfYear] ||| [FieldValue:MonthOfYear] [FieldValue:OrdinalDayOfMonth] ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:NumericDayOfMonth] [FieldValue:MonthOfYear] ||| [FieldValue:MonthOfYear] [FieldValue:NumericDayOfMonth] ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:NumericDayOfMonth] [FieldValue:NumericMonthOfYear] ||| [FieldValue:NumericMonthOfYear] [FieldValue:NumericDayOfMonth] ||| 1.0 - -[FieldValue:MonthDay] ||| [FieldValue:DayOfWeek] [FieldValue:MonthDay] ||| [FieldValue:DayOfWeek] [FieldValue:MonthDay] ||| 1.0 -[FieldValue:MonthDay] ||| día [FieldValue:MonthDay] ||| [FieldValue:MonthDay] ||| 1.0 - -// ============================================================================ -// 15. Combinaciones parciales de tiempo // Partial combinations of time fields -// ============================================================================ -[FieldValue:PartialTime] ||| [FieldValue:Time] ||| [FieldValue:Time] ||| 1.0 -[FieldValue:PartialTime] ||| [FieldValue:PartOfDay] ||| [FieldValue:PartOfDay] ||| 1.0 - -//[FieldValue:PartialYear] ||| del [Int:0-99] ||| YEAR_OF_CENTURY [Int:0-99] ||| 1.0 -[FieldValue:PartialYear] ||| en el [Int:0-99] ||| YEAR_OF_CENTURY [Int:0-99] ||| 1.0 -[FieldValue:PartialYear] ||| año [Int:0-99] ||| YEAR_OF_CENTURY [Int:0-99] ||| 1.0 -[FieldValue:PartialYearMonthDay] ||| [FieldValue:MonthDay] ||| [FieldValue:MonthDay] ||| 1.0 -[FieldValue:PartialYearMonthDay] ||| [FieldValue:MonthDay] [Int:0-99] ||| ( FieldValue YEAR_OF_CENTURY [Int:0-99] ) [FieldValue:MonthDay] ||| 1.0 -[FieldValue:PartialYearMonthDay] ||| [FieldValue:MonthDay] [FieldValue:PartialYear] ||| [FieldValue:PartialYear] [FieldValue:MonthDay] ||| 1.0 - -[FieldValue:Partial] ||| [FieldValue:PartialTime] ||| [FieldValue:PartialTime] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:PartialYear] ||| [FieldValue:PartialYear] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:PartialYearMonthDay] ||| [FieldValue:PartialYearMonthDay] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:PartialYearMonthDay] [FieldValue:PartialTime] ||| [FieldValue:PartialYearMonthDay] [FieldValue:PartialTime] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:PartialTime] [FieldValue:PartialYearMonthDay] ||| [FieldValue:PartialYearMonthDay] [FieldValue:PartialTime] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:WeekendOfWeek] ||| [FieldValue:WeekendOfWeek] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:Month] ||| [FieldValue:Month] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:MonthOfYear] ||| [FieldValue:MonthOfYear] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:SeasonOfYear] ||| [FieldValue:SeasonOfYear] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:QuarterOfYear] ||| [FieldValue:QuarterOfYear] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:MonthOfYear] [FieldValue:PartialYear] ||| [FieldValue:PartialYear] [FieldValue:MonthOfYear] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:SeasonOfYear] [FieldValue:PartialYear] ||| [FieldValue:PartialYear] [FieldValue:SeasonOfYear] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:QuarterOfYear] [FieldValue:PartialYear] ||| [FieldValue:PartialYear] [FieldValue:QuarterOfYear] ||| 1.0 - -// P.ej., "otoño del 20" (para que no coincida con "del 20" como día) -[FieldValue:Partial] ||| [FieldValue:MonthOfYear] del [Int:0-99] ||| ( FieldValue YEAR_OF_CENTURY [Int:0-99] ) [FieldValue:MonthOfYear] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:SeasonOfYear] del [Int:0-99] ||| ( FieldValue YEAR_OF_CENTURY [Int:0-99] ) [FieldValue:SeasonOfYear] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:QuarterOfYear] del [Int:0-99] ||| ( FieldValue YEAR_OF_CENTURY [Int:0-99] ) [FieldValue:QuarterOfYear] ||| 1.0 - -// ============================================================================= -// 16. Combinaciones absolutas de tiempo // Absolute combinations of time fields -// ============================================================================= -[FieldValue:Year] ||| [Int:100-9999] ||| YEAR [Int:100-9999] ||| 1.0 -[FieldValue:Year] ||| [Int:4Digit] ||| YEAR [Int:4Digit] ||| 1.0 - -[FieldValue:Year] ||| año [FieldValue:Year] ||| [FieldValue:Year] ||| 1.0 -[FieldValue:YearMonth] ||| [FieldValue:MonthOfYear] [FieldValue:Year] ||| [FieldValue:Year] [FieldValue:MonthOfYear] ||| 1.0 -[FieldValue:YearMonthDay] ||| [FieldValue:MonthDay] [FieldValue:Year] ||| [FieldValue:Year] [FieldValue:MonthDay] ||| 1.0 -// P. ej., "2000-05-31" (común en los DCT) -[FieldValue:YearMonthDay] ||| [FieldValue:Year] [FieldValue:NumericMonthOfYear] [FieldValue:NumericDayOfMonth] ||| [FieldValue:Year] [FieldValue:NumericMonthOfYear] [FieldValue:NumericDayOfMonth] ||| 1.0 - -[FieldValue:Absolute] ||| [FieldValue:Year] ||| [FieldValue:Year] ||| 1.0 -[FieldValue:Absolute] ||| [FieldValue:QuarterOfYear] [FieldValue:Year] ||| [FieldValue:Year] [FieldValue:QuarterOfYear] ||| 1.0 -[FieldValue:Absolute] ||| [FieldValue:YearMonth] ||| [FieldValue:YearMonth] ||| 1.0 -[FieldValue:Absolute] ||| [FieldValue:YearMonthDay] ||| [FieldValue:YearMonthDay] ||| 1.0 -[FieldValue:Absolute] ||| [FieldValue:YearMonthDay] [FieldValue:Time] ||| [FieldValue:YearMonthDay] [FieldValue:Time] ||| 1.0 - -// ====================================== -// 17. Periodos simples // Simple periods -// ====================================== -[Period] ||| [Unit:Singular] ||| Simple [Unit:Singular] ||| 1.0 -[Period] ||| [Int] [Unit] ||| Simple [Int] [Unit] ||| 1.0 - -[Period:Simple] ||| quincena ||| Simple 15 DAYS ||| 1.0 -[Period:Simple] ||| quincenas ||| Simple 15 DAYS ||| 1.0 -[Period:Simple] ||| bimestre ||| Simple 2 MONTHS ||| 1.0 -[Period:Simple] ||| bimestres ||| Simple 2 MONTHS ||| 1.0 -[Period:Simple] ||| cuatrimestre ||| Simple 4 MONTHS ||| 1.0 -[Period:Simple] ||| cuatrimestres ||| Simple 4 MONTHS ||| 1.0 -[Period:Simple] ||| semestre ||| Simple 6 MONTHS ||| 1.0 -[Period:Simple] ||| semestres ||| Simple 6 MONTHS ||| 1.0 -[Period:Simple] ||| bienio ||| Simple 2 YEARS ||| 1.0 -[Period:Simple] ||| bienios ||| Simple 2 YEARS ||| 1.0 -[Period:Simple] ||| trienio ||| Simple 3 YEARS ||| 1.0 -[Period:Simple] ||| trienios ||| Simple 3 YEARS ||| 1.0 -[Period:Simple] ||| lustro ||| Simple 5 YEARS ||| 1.0 -[Period:Simple] ||| lustros ||| Simple 5 YEARS ||| 1.0 -[Period:Simple] ||| centenario ||| Simple 100 YEARS ||| 1.0 -[Period:Simple] ||| centenaria ||| Simple 100 YEARS ||| 1.0 -[Period:Simple] ||| centenarios ||| Simple 100 YEARS ||| 1.0 -[Period:Simple] ||| centenarias ||| Simple 100 YEARS ||| 1.0 -[Period:Simple] ||| milenio ||| Simple 1000 YEARS ||| 1.0 -[Period:Simple] ||| milenios ||| Simple 1000 YEARS ||| 1.0 -[Period:Simple] ||| milenario ||| Simple 1000 YEARS ||| 1.0 -[Period:Simple] ||| milenaria ||| Simple 1000 YEARS ||| 1.0 -[Period:Simple] ||| milenarios ||| Simple 1000 YEARS ||| 1.0 -[Period:Simple] ||| milenarias ||| Simple 1000 YEARS ||| 1.0 - -[Period] ||| [Period:Simple] ||| [Period:Simple] ||| 1.0 -[Period] ||| [Int] [Period:Simple] ||| [Period:Simple] ||| 1.0 - -// P. ej., "los primeros nueve meses" -[Period] ||| primer [Unit] ||| Simple [Unit] ||| 1.0 -[Period] ||| primera [Unit] ||| Simple [Unit] ||| 1.0 -[Period] ||| [Int] primeros [Unit] ||| Simple [Int] [Unit] ||| 1.0 -[Period] ||| [Int] primeras [Unit] ||| Simple [Int] [Unit] ||| 1.0 -[Period] ||| primeros [Int] [Unit] ||| Simple [Int] [Unit] ||| 1.0 -[Period] ||| primeras [Int] [Unit] ||| Simple [Int] [Unit] ||| 1.0 -[Period] ||| último [Unit] ||| Simple [Unit] ||| 1.0 -[Period] ||| última [Unit] ||| Simple [Unit] ||| 1.0 -[Period] ||| [Int] últimos [Unit] ||| Simple [Int] [Unit] ||| 1.0 -[Period] ||| [Int] últimas [Unit] ||| Simple [Int] [Unit] ||| 1.0 -[Period] ||| últimos [Int] [Unit] ||| Simple [Int] [Unit] ||| 1.0 -[Period] ||| últimas [Int] [Unit] ||| Simple [Int] [Unit] ||| 1.0 -[Period] ||| estos [Int] [Unit] ||| Simple [Int] [Unit] ||| 1.0 -[Period] ||| estas [Int] [Unit] ||| Simple [Int] [Unit] ||| 1.0 -[Period] ||| [Int] [Unit] más ||| Simple [Int] [Unit] ||| 1.0 -[Period] ||| [Int] [Unit] menos ||| Simple [Int] [Unit] ||| 1.0 - -[Period] ||| segundo [Unit] ||| Simple [Unit] ||| 1.0 -[Period] ||| segunda [Unit] ||| Simple [Unit] ||| 1.0 -[Period] ||| tercer [Unit] ||| Simple [Unit] ||| 1.0 -[Period] ||| tercera [Unit] ||| Simple [Unit] ||| 1.0 -[Period] ||| cuarto [Unit] ||| Simple [Unit] ||| 1.0 -[Period] ||| cuarta [Unit] ||| Simple [Unit] ||| 1.0 - -// P. ej., "un periodo de tres años" -[Period] ||| un periodo de [Int] [Unit] ||| Simple [Int] [Unit] ||| 1.0 -[Period] ||| un período de [Int] [Unit] ||| Simple [Int] [Unit] ||| 1.0 - -// P. ej., "dos años y tres meses" -[Period] ||| [Period,1] y [Period,2] ||| Sum [Period,1] [Period,2] ||| 1.0 - -// ======================================================================= -// 18. Periodos de tiempos fraccionados // Periods with fractional amounts -// ======================================================================= -[Period] ||| [Int,1] [Int,2] / [Int,3] [Unit] ||| Fractional [Int,1] [Int,2] [Int,3] [Unit] ||| 1.0 -[Period] ||| medio [Unit] ||| Fractional ( Int 1 ) ( Int 2 ) [Unit] ||| 1.0 -[Period] ||| media [Unit] ||| Fractional ( Int 1 ) ( Int 2 ) [Unit] ||| 1.0 -[Period] ||| [Int] medios [Unit] ||| Fractional [Int] ( Int 2 ) [Unit] ||| 1.0 -[Period] ||| [Int] medias [Unit] ||| Fractional [Int] ( Int 2 ) [Unit] ||| 1.0 -[Period] ||| [Unit:Singular] y medio ||| Fractional ( Int 1 ) ( Int 1 ) ( Int 2 ) [Unit:Singular] ||| 1.0 -[Period] ||| [Unit:Singular] y media ||| Fractional ( Int 1 ) ( Int 1 ) ( Int 2 ) [Unit:Singular] ||| 1.0 -[Period] ||| [Int] [Unit] y medio ||| Fractional [Int] ( Int 1 ) ( Int 2 ) [Unit] ||| 1.0 -[Period] ||| [Int] [Unit] y media ||| Fractional [Int] ( Int 1 ) ( Int 2 ) [Unit] ||| 1.0 - -// =================================================== -// 19. Periodos sin especificar // Unspecified periods -// =================================================== -[Period:Unspecified] ||| rato ||| Unspecified UNSPECIFIED ||| 1.0 -[Period:Unspecified] ||| tiempo ||| Unspecified UNSPECIFIED ||| 1.0 -[Period:Unspecified] ||| largo rato ||| Unspecified UNSPECIFIED ||| 1.0 -[Period:Unspecified] ||| poco rato ||| Unspecified UNSPECIFIED ||| 1.0 -[Period:Unspecified] ||| mucho rato ||| Unspecified UNSPECIFIED ||| 1.0 -[Period:Unspecified] ||| algo de tiempo ||| Unspecified UNSPECIFIED ||| 1.0 -[Period:Unspecified] ||| algún tiempo ||| Unspecified UNSPECIFIED ||| 1.0 -[Period:Unspecified] ||| cierto tiempo ||| Unspecified UNSPECIFIED ||| 1.0 -[Period:Unspecified] ||| corto tiempo ||| Unspecified UNSPECIFIED ||| 1.0 -[Period:Unspecified] ||| largo tiempo ||| Unspecified UNSPECIFIED ||| 1.0 -[Period:Unspecified] ||| poco tiempo ||| Unspecified UNSPECIFIED ||| 1.0 -[Period:Unspecified] ||| mucho tiempo ||| Unspecified UNSPECIFIED ||| 1.0 -[Period:Unspecified] ||| corto periodo ||| Unspecified UNSPECIFIED ||| 1.0 -[Period:Unspecified] ||| corto período ||| Unspecified UNSPECIFIED ||| 1.0 -[Period:Unspecified] ||| largo periodo ||| Unspecified UNSPECIFIED ||| 1.0 -[Period:Unspecified] ||| largo período ||| Unspecified UNSPECIFIED ||| 1.0 - -[Period:Unspecified] ||| algo [Unit] ||| Unspecified [Unit] ||| 1.0 -[Period:Unspecified] ||| algún [Unit] ||| Unspecified [Unit] ||| 1.0 -[Period:Unspecified] ||| alguna [Unit] ||| Unspecified [Unit] ||| 1.0 -[Period:Unspecified] ||| poco [Unit] ||| Unspecified [Unit] ||| 1.0 -[Period:Unspecified] ||| poca [Unit] ||| Unspecified [Unit] ||| 1.0 -[Period:Unspecified] ||| mucho [Unit] ||| Unspecified [Unit] ||| 1.0 -[Period:Unspecified] ||| mucha [Unit] ||| Unspecified [Unit] ||| 1.0 -//[Period:Unspecified] ||| más [Unit] ||| Unspecified [Unit] ||| 1.0 - -[Period:Unspecified] ||| algunos [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 -[Period:Unspecified] ||| algunas [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 -[Period:Unspecified] ||| varios [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 -[Period:Unspecified] ||| varias [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 -[Period:Unspecified] ||| pocos [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 -[Period:Unspecified] ||| pocas [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 -[Period:Unspecified] ||| muchos [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 -[Period:Unspecified] ||| muchas [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 -//[Period:Unspecified] ||| más [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 - -// P. ej., "semanas" -[Period:Unspecified] ||| [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 - -[Period] ||| [Period:Unspecified] ||| [Period:Unspecified] ||| 1.0 - -// ================================================================ -// 20. Modificadores de periodos de tiempo // Time period modifiers -// ================================================================ -[Period] ||| casi [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| sobre [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| cerca [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| unos [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| unas [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| apenas [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| alrededor [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| en torno [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| más o menos [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| [Period] más o menos ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| aproximadamente [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| [Period] aproximadamente ||| WithModifier [Period] APPROX ||| 1.0 - -[Period] ||| menos de [Period] ||| WithModifier [Period] LESS_THAN ||| 1.0 -[Period] ||| inferior a [Period] ||| WithModifier [Period] LESS_THAN ||| 1.0 - -//[Period] ||| más de [Period] ||| WithModifier [Period] MORE_THAN ||| 1.0 -[Period] ||| superior a [Period] ||| WithModifier [Period] MORE_THAN ||| 1.0 - -[Period] ||| al menos [Period] ||| WithModifier [Period] EQUAL_OR_MORE ||| 1.0 -[Period] ||| no menos de [Period] ||| WithModifier [Period] EQUAL_OR_MORE ||| 1.0 -[Period] ||| mínimo [Period] ||| WithModifier [Period] EQUAL_OR_MORE ||| 1.0 -[Period] ||| como mínimo [Period] ||| WithModifier [Period] EQUAL_OR_MORE ||| 1.0 -[Period] ||| [Period] como mínimo ||| WithModifier [Period] EQUAL_OR_MORE ||| 1.0 -[Period] ||| desde [Period] ||| WithModifier [Period] EQUAL_OR_MORE ||| 1.0 - -[Period] ||| no más de [Period] ||| WithModifier [Period] EQUAL_OR_LESS ||| 1.0 -[Period] ||| máximo [Period] ||| WithModifier [Period] EQUAL_OR_LESS ||| 1.0 -[Period] ||| como máximo [Period] ||| WithModifier [Period] EQUAL_OR_LESS ||| 1.0 -[Period] ||| [Period] como máximo ||| WithModifier [Period] EQUAL_OR_LESS ||| 1.0 -[Period] ||| hasta [Period] ||| WithModifier [Period] EQUAL_OR_LESS ||| 1.0 - -// ======================================== -// 21. Conjuntos de periodos // Period sets -// ======================================== -[PeriodSet] ||| diario ||| WithQuantifier ( Period Simple 1 DAYS ) EVERY ||| 1.0 -[PeriodSet] ||| diaria ||| WithQuantifier ( Period Simple 1 DAYS ) EVERY ||| 1.0 -[PeriodSet] ||| diarios ||| WithQuantifier ( Period Simple 1 DAYS ) EVERY ||| 1.0 -[PeriodSet] ||| diarias ||| WithQuantifier ( Period Simple 1 DAYS ) EVERY ||| 1.0 -[PeriodSet] ||| quincenal ||| WithQuantifier ( Period Simple 15 DAYS ) EVERY ||| 1.0 -[PeriodSet] ||| quincenales ||| WithQuantifier ( Period Simple 15 DAYS ) EVERY ||| 1.0 -[PeriodSet] ||| diariamente ||| WithQuantifier ( Period Simple 1 DAYS ) EVERY ||| 1.0 -[PeriodSet] ||| semanal ||| WithQuantifier ( Period Simple 1 WEEKS ) EVERY ||| 1.0 -[PeriodSet] ||| semanales ||| WithQuantifier ( Period Simple 1 WEEKS ) EVERY ||| 1.0 -[PeriodSet] ||| semanalmente ||| WithQuantifier ( Period Simple 1 WEEKS ) EVERY ||| 1.0 -[PeriodSet] ||| mensual ||| WithQuantifier ( Period Simple 1 MONTHS ) EVERY ||| 1.0 -[PeriodSet] ||| mensuales ||| WithQuantifier ( Period Simple 1 MONTHS ) EVERY ||| 1.0 -[PeriodSet] ||| mensualmente ||| WithQuantifier ( Period Simple 1 MONTHS ) EVERY ||| 1.0 -[PeriodSet] ||| bimestral ||| WithQuantifier ( Period Simple 2 MONTHS ) EVERY ||| 1.0 -[PeriodSet] ||| bimestrales ||| WithQuantifier ( Period Simple 2 MONTHS ) EVERY ||| 1.0 -[PeriodSet] ||| bimestralmente ||| WithQuantifier ( Period Simple 2 MONTHS ) EVERY ||| 1.0 -[PeriodSet] ||| trimestral ||| WithQuantifier ( Period Simple 1 QUARTER_YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| trimestrales ||| WithQuantifier ( Period Simple 1 QUARTER_YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| trimestralmente ||| WithQuantifier ( Period Simple 1 QUARTER_YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| cuatrimestral ||| WithQuantifier ( Period Simple 4 MONTHS ) EVERY ||| 1.0 -[PeriodSet] ||| cuatrimestrales ||| WithQuantifier ( Period Simple 4 MONTHS ) EVERY ||| 1.0 -[PeriodSet] ||| cuatrimestralmente ||| WithQuantifier ( Period Simple 4 MONTHS ) EVERY ||| 1.0 -[PeriodSet] ||| semestral ||| WithQuantifier ( Period Simple 6 MONTHS ) EVERY ||| 1.0 -[PeriodSet] ||| semestrales ||| WithQuantifier ( Period Simple 6 MONTHS ) EVERY ||| 1.0 -[PeriodSet] ||| semestralmente ||| WithQuantifier ( Period Simple 6 MONTHS ) EVERY ||| 1.0 -[PeriodSet] ||| anual ||| WithQuantifier ( Period Simple 1 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| anuales ||| WithQuantifier ( Period Simple 1 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| anualmente ||| WithQuantifier ( Period Simple 1 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| bienal ||| WithQuantifier ( Period Simple 2 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| bienales ||| WithQuantifier ( Period Simple 2 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| bienalmente ||| WithQuantifier ( Period Simple 2 YEARS ) EVERY ||| 1.0 - -[PeriodSet] ||| primaveral ||| WithQuantifier ( Period Simple 1 SPRINGS ) EVERY ||| 1.0 -[PeriodSet] ||| primaverales ||| WithQuantifier ( Period Simple 1 SPRINGS ) EVERY ||| 1.0 -[PeriodSet] ||| estival ||| WithQuantifier ( Period Simple 1 SUMMERS ) EVERY ||| 1.0 -[PeriodSet] ||| estivales ||| WithQuantifier ( Period Simple 1 SUMMERS ) EVERY ||| 1.0 -[PeriodSet] ||| otoñal ||| WithQuantifier ( Period Simple 1 FALLS ) EVERY ||| 1.0 -[PeriodSet] ||| otoñales ||| WithQuantifier ( Period Simple 1 FALLS ) EVERY ||| 1.0 -[PeriodSet] ||| invernal ||| WithQuantifier ( Period Simple 1 WINTERS ) EVERY ||| 1.0 -[PeriodSet] ||| invernales ||| WithQuantifier ( Period Simple 1 WINTERS ) EVERY ||| 1.0 - -[PeriodSet] ||| cada [Period] ||| WithQuantifier [Period] EVERY ||| 1.0 -[PeriodSet] ||| por [Period] ||| WithQuantifier [Period] EVERY ||| 1.0 -[PeriodSet] ||| una vez [Period] ||| WithQuantifier [Period] EVERY ||| 1.0 -[PeriodSet] ||| una vez cada [Period] ||| WithQuantifier [Period] EVERY ||| 1.0 -[PeriodSet] ||| una vez por [Period] ||| WithQuantifier [Period] EVERY ||| 1.0 -[PeriodSet] ||| todos [Period] ||| WithQuantifier [Period] EVERY ||| 1.0 -[PeriodSet] ||| todas [Period] ||| WithQuantifier [Period] EVERY ||| 1.0 - -// ============= -// 22. TimeSpans -// ============= -[TimeSpan] ||| [TimeSpan:Solo] ||| [TimeSpan:Solo] ||| 1.0 -[TimeSpan] ||| [TimeSpan:Regular] ||| [TimeSpan:Regular] ||| 1.0 - -// ============================================================================ -// 23. TimeSpans que no se pueden combinar // Time spans that can't be combined -// ============================================================================ -[TimeSpan:Solo] ||| pasado ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| pasada ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| pasados ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| pasadas ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| antes ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| antaño ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| anterior ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| anteriores ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| anteriormente ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| previo ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| previa ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| previos ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| previas ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| previamente ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| reciente ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| recientes ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| recientemente ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| más reciente ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| más recientes ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| más recientemente ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| menos reciente ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| menos recientes ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| menos recientemente ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| recién ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| antiguo ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| antigua ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| antiguos ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| antiguas ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| más antiguo ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| más antigua ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| más antiguos ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| más antiguas ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| menos antiguo ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| menos antigua ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| menos antiguos ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| menos antiguas ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| antiguamente ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| entonces ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| aquel entonces ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| ese momento ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| esos momentos ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| aquel momento ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| aquellos momentos ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| ese instante ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| esos instantes ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| aquel instante ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| aquellos instantes ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| últimamente ||| Simple PAST ||| 1.0 - -[TimeSpan:Solo] ||| presente ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| presentes ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| actual ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| actuales ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| nás actual ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| más actuales ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| menos actual ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| menos actuales ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| actualmente ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| actualidad ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| el momento ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| este momento ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| estos momentos ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| momentáneo ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| este instante ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| estos instantes ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| estos días ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| a día de hoy ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| hoy en día ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| hoy por hoy ||| Simple PRESENT ||| 1.0 - -[TimeSpan:Solo] ||| futuro ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| futura ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| futuros ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| futuras ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| próximo ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| próxima ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| próximos ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| próximas ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| próximamente ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| a partir de ahora ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| de ahora en adelante ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| corto plazo ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| medio plazo ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| largo plazo ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| cualquier momento ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| algún día ||| Simple FUTURE ||| 1.0 - -// Otros casos: p. ej., "hace mucho tiempo" -[TimeSpan:Solo] ||| hace poco ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| hace mucho ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| poco antes ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| mucho antes ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| poco atrás ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| mucho atrás ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| poco después ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| mucho después ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| poco más tarde ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| mucho más tarde ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| dentro de poco ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| dentro de mucho ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| en poco ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| en mucho ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| al cabo de poco ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| al cabo de mucho ||| Simple FUTURE ||| 1.0 - -[TimeSpan:Solo] ||| hace [Period:Unspecified] ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| [Period:Unspecified] antes ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| [Period:Unspecified] atrás ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| [Period:Unspecified] después ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| [Period:Unspecified] más tarde ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| dentro de [Period:Unspecified] ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| en [Period:Unspecified] ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| al cabo de [Period:Unspecified] ||| Simple FUTURE ||| 1.0 - -// ======================================================================================= -// 24. TimeSpans absolutos, décadas y siglos // Absolute time spans, decades and centuries -// ======================================================================================= -[TimeSpan:AllowsThis] ||| [FieldValue:Absolute] ||| FindAbsolute [FieldValue:Absolute] ||| 1.0 - -// P. ej., "la década de 1984", "los años treinta" -[TimeSpan:Regular] ||| la década de [FieldValue:Year] ||| FindEnclosing ( TimeSpan FindAbsolute [FieldValue:Year] ) DECADES ||| 1.0 -[TimeSpan:Regular] ||| los años [Int:Tens] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY [Int:Tens] ) ||| 1.0 -[TimeSpan:Regular] ||| los [Int:Tens] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY [Int:Tens] ) ||| 1.0 -[TimeSpan:Regular] ||| los años veinte ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 2 ) ||| 1.0 -[TimeSpan:Regular] ||| los veinte ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 2 ) ||| 1.0 -[TimeSpan:Regular] ||| los años dos mil ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 0 ) ||| 1.0 -[TimeSpan:Regular] ||| los dos mil ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 0 ) ||| 1.0 - -[TimeSpan:Regular] ||| los años 20 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 2 ) ||| 1.0 -[TimeSpan:Regular] ||| los 20 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 2 ) ||| 1.0 -[TimeSpan:Regular] ||| los años 30 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 3 ) ||| 1.0 -[TimeSpan:Regular] ||| los 30 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 3 ) ||| 1.0 -[TimeSpan:Regular] ||| los años 40 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 4 ) ||| 1.0 -[TimeSpan:Regular] ||| los 40 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 4 ) ||| 1.0 -[TimeSpan:Regular] ||| los años 50 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 5 ) ||| 1.0 -[TimeSpan:Regular] ||| los 50 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 5 ) ||| 1.0 -[TimeSpan:Regular] ||| los años 60 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 6 ) ||| 1.0 -[TimeSpan:Regular] ||| los 60 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 6 ) ||| 1.0 -[TimeSpan:Regular] ||| los años 70 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 7 ) ||| 1.0 -[TimeSpan:Regular] ||| los 70 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 7 ) ||| 1.0 -[TimeSpan:Regular] ||| los años 80 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 8 ) ||| 1.0 -[TimeSpan:Regular] ||| los 80 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 8 ) ||| 1.0 -[TimeSpan:Regular] ||| los años 90 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 9 ) ||| 1.0 -[TimeSpan:Regular] ||| los 90 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 9 ) ||| 1.0 -[TimeSpan:Regular] ||| los años 2000 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 0 ) ||| 1.0 -[TimeSpan:Regular] ||| los 2000 ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 0 ) ||| 1.0 - -[TimeSpan:Regular] ||| siglo [Int] ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY [Int] ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo i ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 1 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo ii ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 2 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo iii ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 3 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo iv ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 4 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo v ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 5 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo vi ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 6 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo vii ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 7 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo viii ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 8 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo ix ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 9 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo x ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 10 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo xi ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 11 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo xii ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 12 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo xiii ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 13 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo xiv ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 14 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo xv ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 15 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo xvi ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 16 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo xvii ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 17 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo xviii ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 18 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo xix ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 19 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo xx ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 20 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -[TimeSpan:Regular] ||| siglo xxi ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY 21 ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 - -// =============================================== -// 25. TimeSpans de presente // Current time spans -// =============================================== -[TimeSpan:Regular] ||| ahora ||| Simple PRESENT ||| 1.0 -[TimeSpan:Regular] ||| hoy ||| FindEnclosing PRESENT DAYS ||| 1.0 -[TimeSpan:Regular] ||| hoy [FieldValue:PartialYearMonthDay] ||| FindEnclosing PRESENT DAYS ||| 1.0 -[TimeSpan:Regular] ||| hoy [FieldValue:YearMonthDay] ||| FindEnclosing PRESENT DAYS ||| 1.0 -[TimeSpan:Regular] ||| fecha ||| FindEnclosing PRESENT DAYS ||| 1.0 - -// P. ej., "este año" -[TimeSpan:Regular] ||| el [Unit:Singular] ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -[TimeSpan:Regular] ||| la [Unit:Singular] ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -[TimeSpan:Regular] ||| del [Unit:Singular] ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -[TimeSpan:Regular] ||| de la [Unit:Singular] ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -[TimeSpan:Regular] ||| este [Unit:Singular] ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -[TimeSpan:Regular] ||| esta [Unit:Singular] ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -[TimeSpan:Regular] ||| actual [Unit:Singular] ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -[TimeSpan:Regular] ||| [Unit:Singular] actual ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -[TimeSpan:Regular] ||| presente [Unit:Singular] ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 - -// P. ej., "esta tarde" -[TimeSpan:Regular] ||| este [FieldValue:Partial] ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT [FieldValue:Partial] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| esta [FieldValue:Partial] ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT [FieldValue:Partial] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| actual [FieldValue:Partial] ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT [FieldValue:Partial] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] actual ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT [FieldValue:Partial] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| presente [FieldValue:Partial] ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT [FieldValue:Partial] ) [FieldValue:Partial] ||| 1.0 - -// P. ej., "enero de este año" -[TimeSpan:Regular] ||| [FieldValue:Partial] de este [Unit] ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT [Unit] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] de esta [Unit] ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT [Unit] ) [FieldValue:Partial] ||| 1.0 - -// ============================================= -// 26. TimeSpans de pasado // Earlier time spans -// ============================================= -[TimeSpan:Regular] ||| ayer ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 1 DAYS ) ||| 1.0 -[TimeSpan:Regular] ||| ayer [FieldValue:PartialYearMonthDay] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 1 DAYS ) ||| 1.0 -[TimeSpan:Regular] ||| ayer [FieldValue:YearMonthDay] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 1 DAYS ) ||| 1.0 -[TimeSpan:Regular] ||| víspera ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 1 DAYS ) ||| 1.0 -[TimeSpan:AllowsThis] ||| anoche ||| FindEarlier PRESENT ( FieldValue NIGHT_OF_DAY 1 ) ||| 1.0 -[TimeSpan:Regular] ||| anteayer ||| EndAtStartOf ( TimeSpan MoveEarlier PRESENT DAYS ) ( Period Simple 1 DAYS ) ||| 1.0 -[TimeSpan:Regular] ||| antes de ayer ||| EndAtStartOf ( TimeSpan MoveEarlier PRESENT DAYS ) ( Period Simple 1 DAYS ) ||| 1.0 - -// P. ej., "el pasado octubre" -[TimeSpan:AllowsThis] ||| último [FieldValue:Partial] ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| última [FieldValue:Partial] ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| pasado [FieldValue:Partial] ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| pasada [FieldValue:Partial] ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| [FieldValue:Partial] pasado ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| [FieldValue:Partial] pasada ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| anterior [FieldValue:Partial] ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| [FieldValue:Partial] anterior ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 - -// P. ej., "las últimas tres semanas" -[TimeSpan:Regular] ||| ese [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:Regular] ||| esa [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:Regular] ||| esos [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:Regular] ||| esas [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:Regular] ||| aquel [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:Regular] ||| aquella [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:Regular] ||| aquellos [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:Regular] ||| aquellas [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| último [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| última [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| últimos [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| últimas [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| pasado [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| pasada [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| pasados [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| pasadas [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] pasado ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] pasada ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] pasados ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] pasadas ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| anterior [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| anteriores [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] anterior ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] anteriores ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 - -// P. ej., "hace tres años" -[TimeSpan:Regular] ||| hace [Period] ||| MoveEarlier ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:Regular] ||| [Period] antes ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:Regular] ||| [Period] atrás ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 - -// Interpretación alternativa: exactamente [Period] antes -[TimeSpan:Regular] ||| hace [Period] ||| MoveEarlier PRESENT [Period] ||| 1.0 -[TimeSpan:Regular] ||| [Period] antes ||| MoveEarlier PRESENT [Period] ||| 1.0 -[TimeSpan:Regular] ||| [Period] atrás ||| MoveEarlier PRESENT [Period] ||| 1.0 - -// P. ej., "el día antes del último martes" -[TimeSpan:Regular] ||| [Period] antes [TimeSpan:Regular] ||| EndAtStartOf ( TimeSpan FindEnclosing [TimeSpan:Regular] [Period] ) [Period] ||| 1.0 -[TimeSpan:Regular] ||| [Period] anterior [TimeSpan:Regular] ||| EndAtStartOf ( TimeSpan FindEnclosing [TimeSpan:Regular] [Period] ) [Period] ||| 1.0 - -// P. ej., "el tercer trimestre del año pasado" -[TimeSpan:Regular] ||| [FieldValue:Partial] del último [Period] ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] de la última [Period] ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] del pasado [Period] ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] de la pasada [Period] ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] del [Period] pasado ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] de la [Period] pasada ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] del [Period] anterior ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] de la [Period] anterior ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] de hace [Period] ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 - -// =========================================== -// 27. TimeSpans de futuro // Later time spans -// =========================================== -[TimeSpan:Regular] ||| mañana ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 1 DAYS ) ||| 1.0 -[TimeSpan:Regular] ||| mañana [FieldValue:PartialYearMonthDay] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 1 DAYS ) ||| 1.0 -[TimeSpan:Regular] ||| mañana [FieldValue:YearMonthDay] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 1 DAYS ) ||| 1.0 -[TimeSpan:Regular] ||| pasado mañana ||| StartAtEndOf ( TimeSpan MoveLater PRESENT DAYS ) ( Period Simple 1 DAYS ) ||| 1.0 - -// P. ej., "próximo martes" -[TimeSpan:AllowsThis] ||| próximo [FieldValue:Partial] ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| próxima [FieldValue:Partial] ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| [FieldValue:Partial] próximo ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| [FieldValue:Partial] próxima ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| siguiente [FieldValue:Partial] ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| [FieldValue:Partial] siguiente ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| [FieldValue:Partial] que viene ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| el [FieldValue:Partial] después ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| la [FieldValue:Partial] después ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 - -// P. ej., "próximo año" -[TimeSpan:AllowsThis] ||| próximo [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| próxima [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| próximos [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| próximas [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] próximo ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] próxima ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] próximos ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] próximas ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| siguiente [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| siguientes [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] siguiente ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] siguientes ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] que viene ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 - -// P. ej., "el día después" -[TimeSpan:Regular] ||| el [Period] después ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:Regular] ||| la [Period] después ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 - -// Interpretación alternativa: exactamente [Period] después -[TimeSpan:Regular] ||| [Period] después ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:Regular] ||| [Period] más tarde ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:Regular] ||| al [Period] siguiente ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:Regular] ||| a la [Period] siguiente ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:Regular] ||| dentro de [Period] ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:Regular] ||| en [Period] ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:Regular] ||| al cabo de [Period] ||| MoveLater PRESENT [Period] ||| 1.0 - -// P. ej., "el tercer trimestre del próximo año" -[TimeSpan:Regular] ||| [FieldValue:Partial] del próximo [Period] ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] de la próxima [Period] ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] del [Period] próximo ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] de la [Period] próxima ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] del siguiente [Period] ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] de la siguiente [Period] ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] del [Period] siguiente ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] de la [Period] siguiente ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] del [Period] que viene ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] de la [Period] que viene ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 - -// ================================================================================= -// 28. Demostrativos para reglas :AllowsThis // Demonstratives for :AllowsThis rules -// ================================================================================= -[TimeSpan:Regular] ||| [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 - -[TimeSpan:Regular] ||| este [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| esta [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| estos [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| estas [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| ese [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| esa [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| esos [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| esas [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| aquel [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| aquella [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| aquellos [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| aquellas [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 - -// ========================================================================================= -// 29. Expresiones referidas al pasado o al futuro // Expressions referred to past or future -// ========================================================================================= -// P. ej., "viernes", "el fin de semana", "11 de octubre" -[TimeSpan:Regular] ||| [FieldValue:Partial] ||| FindAtOrEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 - -// ======================================================================== -// 30. Expresiones compuestas // Expressions changing time span granularity -// ======================================================================== -// P. ej., "la semana del 6 de marzo", "el trimestre de hace un año" -[TimeSpan:Regular] ||| [Unit:Singular] [TimeSpan:Regular] ||| FindEnclosing [TimeSpan:Regular] [Unit:Singular] ||| 1.0 - -// P. ej., "Día de Navidad" (genera conflictos con otras reglas) -// [TimeSpan:Regular] ||| [TimeSpan:Regular] [Unit:Singular] ||| FindEnclosing [TimeSpan:Regular] [Unit:Singular] ||| 1.0 - -// P. ej., "la tarde de ayer" -[TimeSpan:Regular] ||| [FieldValue:PartOfDay] [TimeSpan:Regular] ||| FindEnclosed [TimeSpan:Regular] [FieldValue:PartOfDay] ||| 1.0 - -// P. ej., "invierno de 1994", "el tercer trimestre de este año" -[TimeSpan:Regular] ||| [FieldValue:Partial] [TimeSpan:Regular] ||| FindEnclosed [TimeSpan:Regular] [FieldValue:Partial] ||| 1.0 - -// ===================================================== -// 31. Modificadores de TimeSpans // Time span modifiers -// ===================================================== -// P. ej., "inicio del mes" -[TimeSpan:Regular] ||| inicio [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) START ||| 1.0 -[TimeSpan:Regular] ||| principio [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) START ||| 1.0 -[TimeSpan:Regular] ||| principios [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) START ||| 1.0 -[TimeSpan:Regular] ||| comienzo [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) START ||| 1.0 -[TimeSpan:Regular] ||| comienzos [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) START ||| 1.0 -[TimeSpan:Regular] ||| primeros de [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) START ||| 1.0 -[TimeSpan:Regular] ||| inicio [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| principio [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| principios [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| comienzo [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| comienzos [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| primeros de [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| primeros días de [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 - -// P. ej., "a mediados de mes" -[TimeSpan:Regular] ||| mitad [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) MID ||| 1.0 -[TimeSpan:Regular] ||| mediados [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) MID ||| 1.0 -[TimeSpan:Regular] ||| mitad [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] MID ||| 1.0 -[TimeSpan:Regular] ||| mediados [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] MID ||| 1.0 - -// P. ej., "finales de año" -[TimeSpan:Regular] ||| fin [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) END ||| 1.0 -[TimeSpan:Regular] ||| final [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) END ||| 1.0 -[TimeSpan:Regular] ||| finales [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) END ||| 1.0 -[TimeSpan:Regular] ||| últimos de [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) END ||| 1.0 -[TimeSpan:Regular] ||| fin [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 -[TimeSpan:Regular] ||| final [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 -[TimeSpan:Regular] ||| finales [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 -[TimeSpan:Regular] ||| últimos de [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 - -// P. ej., "alrededor del mes pasado" -[TimeSpan:Regular] ||| casi [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| sobre [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| cerca [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| unos [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| unas [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| apenas [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| alrededor [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| en torno [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| más o menos [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| [TimeSpan:Regular] más o menos ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| aproximadamente [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| [TimeSpan:Regular] aproximadamente ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 - -// P. ej., "antes del último mes" -[TimeSpan:Regular] ||| antes [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] BEFORE ||| 1.0 - -// P. ej., "después de este próximo mes" -[TimeSpan:Regular] ||| después [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] AFTER ||| 1.0 - -// P. ej., "hasta diciembre del año siguiente" -[TimeSpan:Regular] ||| hasta [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] ON_OR_BEFORE ||| 1.0 -[TimeSpan:Regular] ||| [TimeSpan:Regular] o antes ||| WithModifier [TimeSpan:Regular] ON_OR_BEFORE ||| 1.0 -[TimeSpan:Regular] ||| [TimeSpan:Regular] o menos ||| WithModifier [TimeSpan:Regular] ON_OR_BEFORE ||| 1.0 -[TimeSpan:Regular] ||| como mucho [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] ON_OR_BEFORE ||| 1.0 -[TimeSpan:Regular] ||| [TimeSpan:Regular] como mucho ||| WithModifier [TimeSpan:Regular] ON_OR_BEFORE ||| 1.0 - -// P. ej., "desde el primer lunes del mes que viene" -[TimeSpan:Regular] ||| desde [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] ON_OR_AFTER ||| 1.0 -[TimeSpan:Regular] ||| a partir [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] ON_OR_AFTER ||| 1.0 -[TimeSpan:Regular] ||| al menos [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] ON_OR_AFTER ||| 1.0 -[TimeSpan:Regular] ||| [TimeSpan:Regular] al menos ||| WithModifier [TimeSpan:Regular] ON_OR_AFTER ||| 1.0 - -// ========================================================================================== -// 32. Campos usados solo en los conjuntos de TimeSpans // Fields used only by time span sets -// ========================================================================================== -[FieldValue:Unspecified] ||| mañanas ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| tardes ||| AFTERNOON_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| noches ||| NIGHT_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| fines de semana ||| WEEKEND_OF_WEEK 1 ||| 1.0 -[FieldValue:Unspecified] ||| primaveras ||| SPRING_OF_YEAR 1 ||| 1.0 -[FieldValue:Unspecified] ||| veranos ||| SUMMER_OF_YEAR 1 ||| 1.0 -[FieldValue:Unspecified] ||| otoños ||| FALL_OF_YEAR 1 ||| 1.0 -[FieldValue:Unspecified] ||| inviernos ||| WINTER_OF_YEAR 1 ||| 1.0 -[FieldValue:Unspecified] ||| primeros trimestres ||| QUARTER_OF_YEAR 1 ||| 1.0 -[FieldValue:Unspecified] ||| segundos trimestres ||| QUARTER_OF_YEAR 2 ||| 1.0 -[FieldValue:Unspecified] ||| terceros trimestres ||| QUARTER_OF_YEAR 3 ||| 1.0 -[FieldValue:Unspecified] ||| cuartos trimestres ||| QUARTER_OF_YEAR 4 ||| 1.0 - -// ============================================ -// 33. Conjuntos de TimeSpans // Time span sets -// ============================================ -// P. ej., "cada otoño", "todos los jueves" -[TimeSpanSet] ||| cada [FieldValue:Partial] ||| Simple [FieldValue:Partial] ||| 1.0 -[TimeSpanSet] ||| por [FieldValue:Partial] ||| Simple [FieldValue:Partial] ||| 1.0 -[TimeSpanSet] ||| una vez [FieldValue:Partial] ||| Simple [FieldValue:Partial] ||| 1.0 -[TimeSpanSet] ||| una vez cada [FieldValue:Partial] ||| Simple [FieldValue:Partial] ||| 1.0 -[TimeSpanSet] ||| una vez por [FieldValue:Partial] ||| Simple [FieldValue:Partial] ||| 1.0 -[TimeSpanSet] ||| todos [FieldValue:Partial] ||| Simple [FieldValue:Partial] ||| 1.0 -[TimeSpanSet] ||| todas [FieldValue:Partial] ||| Simple [FieldValue:Partial] ||| 1.0 - -// P. ej., "primaveras" -[TimeSpanSet] ||| [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 - -// P. ej., "noches de jueves" -[TimeSpanSet] ||| [FieldValue:Unspecified] [FieldValue:Partial] ||| Simple ( FieldValue [FieldValue:Partial] [FieldValue:Unspecified] ) ||| 1.0 - -// P. ej., "los últimos tres veranos" -[TimeSpanSet] ||| estos [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| estas [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| estos [Int] [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| estas [Int] [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| esos [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| esas [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| esos [Int] [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| esas [Int] [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| aquellos [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| aquellas [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| aquellos [Int] [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| aquellas [Int] [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 - -[TimeSpanSet] ||| últimos [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| últimas [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| [Int] últimos [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| [Int] últimas [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| últimos [Int] [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| últimas [Int] [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 - -[TimeSpanSet] ||| próximos [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| próximas [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| [Int] próximos [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| [Int] próximas [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| próximos [Int] [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -[TimeSpanSet] ||| próximas [Int] [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 - -// P. ej., "todas las mañanas" -[TimeSpanSet] ||| todos [TimeSpanSet] ||| [TimeSpanSet] ||| 1.0 -[TimeSpanSet] ||| todas [TimeSpanSet] ||| [TimeSpanSet] ||| 1.0 diff --git a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/it.grammar b/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/it.grammar deleted file mode 100755 index 8273726..0000000 --- a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/it.grammar +++ /dev/null @@ -1,1016 +0,0 @@ -ROOTS [Period] [PeriodSet] [TimeSpan] [TimeSpanSet] - -// ==================================================================================== -// expressions that appear in other places in the grammar but can sometimes be ignored -// (if an expression occurs nowhere in the grammar, it does not need to be listed here) -// ==================================================================================== -[Nil] ||| un ||| ||| 1.0 -[Nil] ||| una ||| ||| 1.0 -[Nil] ||| il ||| ||| 1.0 -[Nil] ||| la ||| ||| 1.0 -[Nil] ||| lo ||| ||| 1.0 -[Nil] ||| l ' ||| ||| 1.0 -[Nil] ||| le ||| ||| 1.0 -[Nil] ||| gli ||| ||| 1.0 -[Nil] ||| . ||| ||| 1.0 -[Nil] ||| , ||| ||| 1.0 -[Nil] ||| - ||| ||| 1.0 -[Nil] ||| / ||| ||| 1.0 -[Nil] ||| ' a ||| ||| 1.0 -[Nil] ||| e ||| ||| 1.0 -[Nil] ||| ' ||| ||| 1.0 -[Nil] ||| ` ||| ||| 1.0 - -// ==================================== -// expressions that identify an integer -// ==================================== -[Int:1Digit] ||| uno ||| 1 ||| 1.0 -[Int:1Digit] ||| una ||| 1 ||| 1.0 -[Int:1Digit] ||| un ' ||| 1 ||| 1.0 -[Int:1Digit] ||| due ||| 2 ||| 1.0 -[Int:1Digit] ||| tre ||| 3 ||| 1.0 -[Int:1Digit] ||| quattro ||| 4 ||| 1.0 -[Int:1Digit] ||| quattr ' ||| 4 ||| 1.0 -[Int:1Digit] ||| cinque ||| 5 ||| 1.0 -[Int:1Digit] ||| sei ||| 6 ||| 1.0 -[Int:1Digit] ||| sette ||| 7 ||| 1.0 -[Int:1Digit] ||| otto ||| 8 ||| 1.0 -[Int:1Digit] ||| nove ||| 9 ||| 1.0 -[Int:Teens] ||| dieci ||| 1 0 ||| 1.0 -[Int:Teens] ||| undici ||| 1 1 ||| 1.0 -[Int:Teens] ||| dodici ||| 1 2 ||| 1.0 -[Int:Teens] ||| tredici ||| 1 3 ||| 1.0 -[Int:Teens] ||| quattordici ||| 1 4 ||| 1.0 -[Int:Teens] ||| quindici ||| 1 5 ||| 1.0 -[Int:Teens] ||| sedici ||| 1 6 ||| 1.0 -[Int:Teens] ||| diciassette ||| 1 7 ||| 1.0 -[Int:Teens] ||| diciotto ||| 1 8 ||| 1.0 -[Int:Teens] ||| diciannove ||| 1 9 ||| 1.0 -[Int:Tens] ||| venti ||| 2 ||| 1.0 -[Int:Tens] ||| vent ||| 2 ||| 1.0 -[Int:Tens] ||| trenta ||| 3 ||| 1.0 -[Int:Tens] ||| trent ||| 3 ||| 1.0 -[Int:Tens] ||| quaranta ||| 4 ||| 1.0 -[Int:Tens] ||| quarant ||| 4 ||| 1.0 -[Int:Tens] ||| cinquanta ||| 5 ||| 1.0 -[Int:Tens] ||| cinquant ||| 5 ||| 1.0 -[Int:Tens] ||| sessanta ||| 6 ||| 1.0 -[Int:Tens] ||| sessant ||| 6 ||| 1.0 -[Int:Tens] ||| settanta ||| 7 ||| 1.0 -[Int:Tens] ||| settant ||| 7 ||| 1.0 -[Int:Tens] ||| ottanta ||| 8 ||| 1.0 -[Int:Tens] ||| ottant ||| 8 ||| 1.0 -[Int:Tens] ||| novanta ||| 9 ||| 1.0 -[Int:Tens] ||| novant ||| 9 ||| 1.0 -[Int:2Digit] ||| [Int:Teens] ||| [Int:Teens] ||| 1.0 -[Int:2Digit] ||| [Int:Tens] ||| [Int:Tens] 0 ||| 1.0 -[Int:2Digit] ||| [Int:Tens] [Int:1Digit] ||| [Int:Tens] [Int:1Digit] ||| 1.0 -[Int:Hundred2Digit] ||| cento ||| 0 0 ||| 1.0 -[Int:Hundred2Digit] ||| cento [Int:1Digit] ||| 0 [Int:1Digit] ||| 1.0 -[Int:Hundred2Digit] ||| cento [Int:2Digit] ||| [Int:2Digit] ||| 1.0 -[Int:3Digit] ||| [Int:Hundred2Digit] ||| 1 [Int:Hundred2Digit] ||| 1.0 -[Int:3Digit] ||| [Int:1Digit] [Int:Hundred2Digit] ||| [Int:1Digit] [Int:Hundred2Digit] ||| 1.0 -[Int:Thousand3Digit] ||| mille ||| 0 0 0 ||| 1.0 -[Int:Thousand3Digit] ||| mila ||| 0 0 0 ||| 1.0 -[Int:Thousand3Digit] ||| mille [Int:1Digit] ||| 0 0 [Int:1Digit] ||| 1.0 -[Int:Thousand3Digit] ||| mila [Int:1Digit] ||| 0 0 [Int:1Digit] ||| 1.0 -[Int:Thousand3Digit] ||| mille [Int:2Digit] ||| 0 [Int:2Digit] ||| 1.0 -[Int:Thousand3Digit] ||| mila [Int:2Digit] ||| 0 [Int:2Digit] ||| 1.0 -[Int:Thousand3Digit] ||| mille [Int:3Digit] ||| [Int:3Digit] ||| 1.0 -[Int:Thousand3Digit] ||| mila [Int:3Digit] ||| [Int:3Digit] ||| 1.0 -[Int:4Digit] ||| [Int:Thousand3Digit] ||| 1 [Int:Thousand3Digit] ||| 1.0 -[Int:4Digit] ||| [Int:1Digit] [Int:Thousand3Digit] ||| [Int:1Digit] [Int:Thousand3Digit] ||| 1.0 -[Int:4Digit] ||| [Int:2Digit,1] [Int:2Digit,2] ||| [Int:2Digit,1] [Int:2Digit,2] ||| 1.0 -[Int] ||| [Int:1Digit] ||| [Int:1Digit] ||| 1.0 -[Int] ||| [Int:2Digit] ||| [Int:2Digit] ||| 1.0 -[Int] ||| [Int:3Digit] ||| [Int:3Digit] ||| 1.0 -[Int] ||| [Int:4Digit] ||| [Int:4Digit] ||| 1.0 - -// ================================================= -// other common expressions that identify an integer -// ================================================= -[Int] ||| paio ||| 2 ||| 1.0 -[Int] ||| paio di ||| 2 ||| 1.0 -[Int] ||| paio d ' ||| 2 ||| 1.0 -[Int] ||| coppia ||| 2 ||| 1.0 -[Int] ||| coppia di ||| 2 ||| 1.0 -[Int] ||| coppia d ' ||| 2 ||| 1.0 -[Int] ||| dozzina ||| 12 ||| 1.0 - -// ========================================= -// expressions that identify a temporal unit -// ========================================= -[Unit:Singular] ||| secondo ||| SECONDS ||| 1.0 -[Unit:Singular] ||| minuto ||| MINUTES ||| 1.0 -[Unit:Singular] ||| ora ||| HOURS ||| 1.0 -[Unit:Singular] ||| giorno ||| DAYS ||| 1.0 -[Unit:Singular] ||| giornata ||| DAYS ||| 1.0 -[Unit:Singular] ||| settimana ||| WEEKS ||| 1.0 -[Unit:Singular] ||| mese ||| MONTHS ||| 1.0 -[Unit:Singular] ||| periodo ||| QUARTER_YEARS ||| 1.0 -[Unit:Singular] ||| trimestre ||| QUARTER_YEARS ||| 1.0 -[Unit:Singular] ||| anno ||| YEARS ||| 1.0 -[Unit:Singular] ||| decade ||| DECADES ||| 1.0 -[Unit:Singular] ||| decennio ||| DECADES ||| 1.0 -[Unit:Singular] ||| secolo ||| CENTURIES ||| 1.0 -[Unit:Singular] ||| centennio ||| CENTURIES ||| 1.0 -[Unit] ||| [Unit:Singular] ||| [Unit:Singular] ||| 1.0 -[Unit:Plural] ||| secondi ||| SECONDS ||| 1.0 -[Unit:Plural] ||| minuti ||| MINUTES ||| 1.0 -[Unit:Plural] ||| ore ||| HOURS ||| 1.0 -[Unit:Plural] ||| ore e ore ||| HOURS ||| 1.0 -[Unit:Plural] ||| giorni ||| DAYS ||| 1.0 -[Unit:Plural] ||| giornate ||| DAYS ||| 1.0 -[Unit:Plural] ||| settimane ||| WEEKS ||| 1.0 -[Unit:Plural] ||| mesi ||| MONTHS ||| 1.0 -[Unit:Plural] ||| trimestri ||| QUARTER_YEARS ||| 1.0 -[Unit:Plural] ||| anni ||| YEARS ||| 1.0 -[Unit:Plural] ||| decadi ||| DECADES ||| 1.0 -[Unit:Plural] ||| decenni ||| DECADES ||| 1.0 -[Unit:Plural] ||| secoli ||| CENTURIES ||| 1.0 -[Unit:Plural] ||| centenni ||| CENTURIES ||| 1.0 -[Unit] ||| [Unit:Plural] ||| [Unit:Plural] ||| 1.0 -//[Unit] ||| [Unit:Plural,1] e [Unit:Plural] ||| [Unit:Plural,1] ||| 1.0 - -// ========================================= -// expressions that identify a part of a day -// ========================================= -[FieldValue:HourOfDay] ||| [Int:0-23] ||| HOUR_OF_DAY [Int:0-23] ||| 1.0 -[FieldValue:HourOfAMPM] ||| [Int:1-12] ||| HOUR_OF_AMPM [Int:1-12] ||| 1.0 -[FieldValue:HourOfAMPM] ||| [Int:1Digit] ||| HOUR_OF_AMPM [Int:1Digit] ||| 1.0 -[FieldValue:HourOfAMPM] ||| [Int:Teens] ||| HOUR_OF_AMPM [Int:Teens] ||| 1.0 -[FieldValue:MinuteOfHour] ||| [Int:0-59] ||| MINUTE_OF_HOUR [Int:0-59] ||| 1.0 -[FieldValue:SecondOfMinute] ||| [Int:0-59] ||| SECOND_OF_MINUTE [Int:0-59] ||| 1.0 -[FieldValue:AMPMOfDay] ||| a . m ||| AMPM_OF_DAY 0 ||| 1.0 -[FieldValue:AMPMOfDay] ||| am ||| AMPM_OF_DAY 0 ||| 1.0 -[FieldValue:AMPMOfDay] ||| mattina ||| AMPM_OF_DAY 0 ||| 1.0 -[FieldValue:AMPMOfDay] ||| mattino ||| AMPM_OF_DAY 0 ||| 1.0 -[FieldValue:AMPMOfDay] ||| dell mattina ||| AMPM_OF_DAY 0 ||| 1.0 -[FieldValue:AMPMOfDay] ||| dell mattino ||| AMPM_OF_DAY 0 ||| 1.0 -[FieldValue:AMPMOfDay] ||| p . m ||| AMPM_OF_DAY 1 ||| 1.0 -[FieldValue:AMPMOfDay] ||| pm ||| AMPM_OF_DAY 1 ||| 1.0 -[FieldValue:AMPMOfDay] ||| pomeriggio ||| AMPM_OF_DAY 1 ||| 1.0 -[FieldValue:AMPMOfDay] ||| dell pomeriggio ||| AMPM_OF_DAY 1 ||| 1.0 -[FieldValue:AMPMOfDay] ||| sera ||| AMPM_OF_DAY 1 ||| 1.0 -[FieldValue:AMPMOfDay] ||| dell sera ||| AMPM_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| mattina ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| mattino ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| mattinata ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| mattutino ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| pomeriggio ||| AFTERNOON_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| pomeridiano ||| AFTERNOON_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| ora di pranzo ||| AFTERNOON_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| sera ||| EVENING_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| serata ||| EVENING_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| serale ||| EVENING_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| vigilia ||| EVENING_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| notte ||| NIGHT_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| notturni ||| NIGHT_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| nottata ||| NIGHT_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| nuttata ||| NIGHT_OF_DAY 1 ||| 1.0 -[FieldValue:PartOfDay] ||| nottetempo ||| NIGHT_OF_DAY 1 ||| 1.0 -// part of today -//[FieldValue:PartOfDay] ||| stamattina ||| MORNING_OF_DAY 1 ||| 1.0 -//[FieldValue:PartOfDay] ||| stasera ||| EVENING_OF_DAY 1 ||| 1.0 -//[FieldValue:PartOfDay] ||| stanotte ||| NIGHT_OF_DAY 1 ||| 1.0 - -// =========================================== -// expressions that identify a day of the week -// =========================================== -[FieldValue:DayOfWeek] ||| lunedi ||| DAY_OF_WEEK 1 ||| 1.0 -[FieldValue:DayOfWeek] ||| martedi ||| DAY_OF_WEEK 2 ||| 1.0 -[FieldValue:DayOfWeek] ||| mercoledi ||| DAY_OF_WEEK 3 ||| 1.0 -[FieldValue:DayOfWeek] ||| giovedi ||| DAY_OF_WEEK 4 ||| 1.0 -[FieldValue:DayOfWeek] ||| venerdi ||| DAY_OF_WEEK 5 ||| 1.0 -[FieldValue:DayOfWeek] ||| sabato ||| DAY_OF_WEEK 6 ||| 1.0 -[FieldValue:DayOfWeek] ||| domenica ||| DAY_OF_WEEK 7 ||| 1.0 -[FieldValue:DayOfWeek] ||| lun ||| DAY_OF_WEEK 1 ||| 1.0 -[FieldValue:DayOfWeek] ||| mar ||| DAY_OF_WEEK 2 ||| 1.0 -[FieldValue:DayOfWeek] ||| mart ||| DAY_OF_WEEK 2 ||| 1.0 -[FieldValue:DayOfWeek] ||| mer ||| DAY_OF_WEEK 3 ||| 1.0 -[FieldValue:DayOfWeek] ||| merc ||| DAY_OF_WEEK 3 ||| 1.0 -[FieldValue:DayOfWeek] ||| gio ||| DAY_OF_WEEK 4 ||| 1.0 -[FieldValue:DayOfWeek] ||| giov ||| DAY_OF_WEEK 4 ||| 1.0 -[FieldValue:DayOfWeek] ||| ven ||| DAY_OF_WEEK 5 ||| 1.0 -[FieldValue:DayOfWeek] ||| sab ||| DAY_OF_WEEK 6 ||| 1.0 -[FieldValue:DayOfWeek] ||| dom ||| DAY_OF_WEEK 7 ||| 1.0 -[FieldValue:DayOfWeek] ||| domen ||| DAY_OF_WEEK 7 ||| 1.0 - -// ============================================= -// expressions that identify a weekend of a week -// ============================================= -[FieldValue:WeekendOfWeek] ||| weekend ||| WEEKEND_OF_WEEK 1 ||| 1.0 -[FieldValue:WeekendOfWeek] ||| week end ||| WEEKEND_OF_WEEK 1 ||| 1.0 -[FieldValue:WeekendOfWeek] ||| finesettimana ||| WEEKEND_OF_WEEK 1 ||| 1.0 -[FieldValue:WeekendOfWeek] ||| fine settimana ||| WEEKEND_OF_WEEK 1 ||| 1.0 - -// ========================================== -// expressions that identify a day of a month -// ========================================== -[FieldValue:NumericDayOfMonth] ||| [Int:1-31] ||| DAY_OF_MONTH [Int:1-31] ||| 1.0 -[FieldValue:NumericDayOfMonth] ||| il [Int:1-31] ||| DAY_OF_MONTH [Int:1-31] ||| 1.0 - -// ============================================= -// expressions that identify a month of the year -// ============================================= -[FieldValue:MonthOfYear] ||| gennaio ||| MONTH_OF_YEAR 1 ||| 1.0 -[FieldValue:MonthOfYear] ||| febbraio ||| MONTH_OF_YEAR 2 ||| 1.0 -[FieldValue:MonthOfYear] ||| marzo ||| MONTH_OF_YEAR 3 ||| 1.0 -[FieldValue:MonthOfYear] ||| aprile ||| MONTH_OF_YEAR 4 ||| 1.0 -[FieldValue:MonthOfYear] ||| maggio ||| MONTH_OF_YEAR 5 ||| 1.0 -[FieldValue:MonthOfYear] ||| giugno ||| MONTH_OF_YEAR 6 ||| 1.0 -[FieldValue:MonthOfYear] ||| luglio ||| MONTH_OF_YEAR 7 ||| 1.0 -[FieldValue:MonthOfYear] ||| agosto ||| MONTH_OF_YEAR 8 ||| 1.0 -[FieldValue:MonthOfYear] ||| settembre ||| MONTH_OF_YEAR 9 ||| 1.0 -[FieldValue:MonthOfYear] ||| ottobre ||| MONTH_OF_YEAR 10 ||| 1.0 -[FieldValue:MonthOfYear] ||| novembre ||| MONTH_OF_YEAR 11 ||| 1.0 -[FieldValue:MonthOfYear] ||| dicembre ||| MONTH_OF_YEAR 12 ||| 1.0 -[FieldValue:MonthOfYear] ||| gen ||| MONTH_OF_YEAR 1 ||| 1.0 -[FieldValue:MonthOfYear] ||| genn ||| MONTH_OF_YEAR 1 ||| 1.0 -[FieldValue:MonthOfYear] ||| feb ||| MONTH_OF_YEAR 2 ||| 1.0 -[FieldValue:MonthOfYear] ||| febb ||| MONTH_OF_YEAR 2 ||| 1.0 -[FieldValue:MonthOfYear] ||| mar ||| MONTH_OF_YEAR 3 ||| 1.0 -[FieldValue:MonthOfYear] ||| apr ||| MONTH_OF_YEAR 4 ||| 1.0 -[FieldValue:MonthOfYear] ||| mag ||| MONTH_OF_YEAR 5 ||| 1.0 -[FieldValue:MonthOfYear] ||| magg ||| MONTH_OF_YEAR 5 ||| 1.0 -[FieldValue:MonthOfYear] ||| giu ||| MONTH_OF_YEAR 6 ||| 1.0 -[FieldValue:MonthOfYear] ||| giug ||| MONTH_OF_YEAR 6 ||| 1.0 -[FieldValue:MonthOfYear] ||| lug ||| MONTH_OF_YEAR 7 ||| 1.0 -[FieldValue:MonthOfYear] ||| ag ||| MONTH_OF_YEAR 8 ||| 1.0 -[FieldValue:MonthOfYear] ||| ago ||| MONTH_OF_YEAR 8 ||| 1.0 -[FieldValue:MonthOfYear] ||| set ||| MONTH_OF_YEAR 9 ||| 1.0 -[FieldValue:MonthOfYear] ||| sett ||| MONTH_OF_YEAR 9 ||| 1.0 -[FieldValue:MonthOfYear] ||| ot ||| MONTH_OF_YEAR 10 ||| 1.0 -[FieldValue:MonthOfYear] ||| ott ||| MONTH_OF_YEAR 10 ||| 1.0 -[FieldValue:MonthOfYear] ||| nov ||| MONTH_OF_YEAR 11 ||| 1.0 -[FieldValue:MonthOfYear] ||| dic ||| MONTH_OF_YEAR 12 ||| 1.0 -[FieldValue:NumericMonthOfYear] ||| [Int:1-12] ||| MONTH_OF_YEAR [Int:1-12] ||| 1.0 - -// ====================================================== -// expressions that identify a fiscal quarter of the year -// ====================================================== -[FieldValue:QuarterOfYear] ||| primo periodo ||| QUARTER_OF_YEAR 1 ||| 1.0 -[FieldValue:QuarterOfYear] ||| secondo periodo ||| QUARTER_OF_YEAR 2 ||| 1.0 -[FieldValue:QuarterOfYear] ||| terzo periodo ||| QUARTER_OF_YEAR 3 ||| 1.0 -[FieldValue:QuarterOfYear] ||| quarto periodo ||| QUARTER_OF_YEAR 4 ||| 1.0 -[FieldValue:QuarterOfYear] ||| ultimx periodo ||| QUARTER_OF_YEAR 4 ||| 1.0 -[FieldValue:QuarterOfYear] ||| primo trimestre ||| QUARTER_OF_YEAR 1 ||| 1.0 -[FieldValue:QuarterOfYear] ||| secondo trimestre ||| QUARTER_OF_YEAR 2 ||| 1.0 -[FieldValue:QuarterOfYear] ||| terzo trimestre ||| QUARTER_OF_YEAR 3 ||| 1.0 -[FieldValue:QuarterOfYear] ||| quarto trimestre ||| QUARTER_OF_YEAR 4 ||| 1.0 -[FieldValue:QuarterOfYear] ||| ultimx trimestre ||| QUARTER_OF_YEAR 4 ||| 1.0 - -// ============================================== -// expressions that identify a season of the year -// ============================================== -[FieldValue:SeasonOfYear] ||| primavera ||| SPRING_OF_YEAR 1 ||| 1.0 -[FieldValue:SeasonOfYear] ||| estate ||| SUMMER_OF_YEAR 1 ||| 1.0 -[FieldValue:SeasonOfYear] ||| estivo ||| SUMMER_OF_YEAR 1 ||| 1.0 -[FieldValue:SeasonOfYear] ||| estiva ||| SUMMER_OF_YEAR 1 ||| 1.0 -[FieldValue:SeasonOfYear] ||| autunno ||| FALL_OF_YEAR 1 ||| 1.0 -[FieldValue:SeasonOfYear] ||| inverno ||| WINTER_OF_YEAR 1 ||| 1.0 - -// ======================================= -// expressions that identify a time of day -// ======================================= -[FieldValue:Time] ||| mezzogiorno ||| ( FieldValue:HourOfDay HOUR_OF_DAY 12 ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| mezzanotte ||| ( FieldValue:HourOfDay HOUR_OF_DAY 0 ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| cuore dell notte ||| ( FieldValue:HourOfDay HOUR_OF_DAY 0 ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| [FieldValue:HourOfDay] : [FieldValue:MinuteOfHour] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] ||| 1.0 -[FieldValue:Time] ||| [FieldValue:HourOfDay] . [FieldValue:MinuteOfHour] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] ||| 1.0 -[FieldValue:Time] ||| [FieldValue:HourOfDay] , [FieldValue:MinuteOfHour] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] ||| 1.0 -[FieldValue:Time] ||| [FieldValue:HourOfDay] : [FieldValue:MinuteOfHour] : [FieldValue:SecondOfMinute] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] [FieldValue:SecondOfMinute] ||| 1.0 -[FieldValue:Time] ||| [FieldValue:HourOfAMPM] : [FieldValue:MinuteOfHour] [FieldValue:AMPMOfDay] ||| [FieldValue:HourOfAMPM] [FieldValue:MinuteOfHour] [FieldValue:AMPMOfDay] ||| 1.0 -[FieldValue:Time] ||| [FieldValue:HourOfAMPM] [FieldValue:AMPMOfDay] ||| [FieldValue:HourOfAMPM] ( FieldValue MINUTE_OF_HOUR 0 ) [FieldValue:AMPMOfDay] ||| 1.0 -//e.g. "ore 9", "ore 9.30", "ore 09,30" -[FieldValue:Time] ||| [FieldValue:HourOfDay] di ||| [FieldValue:HourOfDay] ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| [Int:1Digit] di ||| ( FieldValue:HourOfDay HOUR_OF_DAY [Int:1Digit] ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| [Int:2Digit] di ||| ( FieldValue:HourOfDay HOUR_OF_DAY [Int:2Digit] ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| [Int:24-24] di ||| ( FieldValue:HourOfDay HOUR_OF_DAY 0 ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| ore [FieldValue:HourOfDay] ||| [FieldValue:HourOfDay] ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| ore [Int:1Digit] ||| ( FieldValue:HourOfDay HOUR_OF_DAY [Int:1Digit] ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| ore [Int:2Digit] ||| ( FieldValue:HourOfDay HOUR_OF_DAY [Int:2Digit] ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| ore [Int:24-24] ||| ( FieldValue:HourOfDay HOUR_OF_DAY 0 ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| all [FieldValue:HourOfDay] ||| [FieldValue:HourOfDay] ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| all [Int:1Digit] ||| ( FieldValue:HourOfDay HOUR_OF_DAY [Int:1Digit] ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| all [Int:2Digit] ||| ( FieldValue:HourOfDay HOUR_OF_DAY [Int:2Digit] ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| all [Int:24-24] ||| ( FieldValue:HourOfDay HOUR_OF_DAY 0 ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| verso [FieldValue:HourOfDay] ||| [FieldValue:HourOfDay] ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| verso [Int:1Digit] ||| ( FieldValue:HourOfDay HOUR_OF_DAY [Int:1Digit] ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| verso [Int:2Digit] ||| ( FieldValue:HourOfDay HOUR_OF_DAY [Int:2Digit] ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| verso [Int:24-24] ||| ( FieldValue:HourOfDay HOUR_OF_DAY 0 ) ( FieldValue:MinuteOfHour MINUTE_OF_HOUR 0 ) ||| 1.0 -[FieldValue:Time] ||| ore [FieldValue:HourOfDay] : [FieldValue:MinuteOfHour] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] ||| 1.0 -[FieldValue:Time] ||| ore [FieldValue:HourOfDay] . [FieldValue:MinuteOfHour] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] ||| 1.0 -[FieldValue:Time] ||| ore [FieldValue:HourOfDay] , [FieldValue:MinuteOfHour] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] ||| 1.0 -[FieldValue:Time] ||| all [FieldValue:HourOfDay] : [FieldValue:MinuteOfHour] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] ||| 1.0 -[FieldValue:Time] ||| all [FieldValue:HourOfDay] . [FieldValue:MinuteOfHour] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] ||| 1.0 -[FieldValue:Time] ||| all [FieldValue:HourOfDay] , [FieldValue:MinuteOfHour] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] ||| 1.0 -[FieldValue:Time] ||| verso [FieldValue:HourOfDay] : [FieldValue:MinuteOfHour] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] ||| 1.0 -[FieldValue:Time] ||| verso [FieldValue:HourOfDay] . [FieldValue:MinuteOfHour] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] ||| 1.0 -[FieldValue:Time] ||| verso [FieldValue:HourOfDay] , [FieldValue:MinuteOfHour] ||| [FieldValue:HourOfDay] [FieldValue:MinuteOfHour] ||| 1.0 - -// ============================================== -// expressions that identify specially named days -// ============================================== -[FieldValue:NamedDay] ||| ferragosto ||| ( FieldValue MONTH_OF_YEAR 8 ) ( FieldValue DAY_OF_MONTH 15 ) ||| 1.0 -[FieldValue:NamedDay] ||| natale ||| ( FieldValue MONTH_OF_YEAR 12 ) ( FieldValue DAY_OF_MONTH 25 ) ||| 1.0 -[FieldValue:NamedDay] ||| pasqua ||| EASTER_DAY_OF_YEAR 1 ||| 1.0 -//[FieldValue:NamedDay] ||| election ||| ( FieldValue DAY_OF_WEEK 2 ) ( FieldValue MONTH_OF_YEAR 11 ) ( FieldValue ALIGNED_WEEK_OF_MONTH 1 ) ||| 1.0 - -// ================================================ -// expressions that identify both a month and a day -// ================================================ -[FieldValue:MonthDay] ||| [FieldValue:NamedDay] ||| [FieldValue:NamedDay] ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:MonthOfYear] [FieldValue:DayOfMonth] ||| [FieldValue:MonthOfYear] [FieldValue:DayOfMonth] ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:MonthOfYear] [FieldValue:NumericDayOfMonth] ||| [FieldValue:MonthOfYear] [FieldValue:NumericDayOfMonth] ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:NumericDayOfMonth] [FieldValue:MonthOfYear] ||| [FieldValue:MonthOfYear] [FieldValue:NumericDayOfMonth] ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:NumericDayOfMonth] di [FieldValue:MonthOfYear] ||| [FieldValue:MonthOfYear] [FieldValue:NumericDayOfMonth] ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:NumericDayOfMonth] d ' [FieldValue:MonthOfYear] ||| [FieldValue:MonthOfYear] [FieldValue:NumericDayOfMonth] ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:DayOfWeek] [FieldValue:NumericDayOfMonth] [FieldValue:MonthOfYear] ||| [FieldValue:MonthOfYear] [FieldValue:NumericDayOfMonth] ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:DayOfWeek] [Int:1Digit] [FieldValue:MonthOfYear] ||| [FieldValue:MonthOfYear] ( FieldValue DAY_OF_MONTH [Int:1Digit] ) ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:DayOfWeek] [Int:2Digit] [FieldValue:MonthOfYear] ||| [FieldValue:MonthOfYear] ( FieldValue DAY_OF_MONTH [Int:2Digit] ) ||| 1.0 -//[FieldValue:MonthDay] ||| [FieldValue:NumericMonthOfYear] [FieldValue:NumericDayOfMonth] ||| [FieldValue:NumericMonthOfYear] [FieldValue:NumericDayOfMonth] ||| 1.0 -[FieldValue:MonthDay] ||| [FieldValue:NumericDayOfMonth] [FieldValue:NumericMonthOfYear] ||| [FieldValue:NumericMonthOfYear] [FieldValue:NumericDayOfMonth] ||| 1.0 - -// =========================================================== -// combinations of time fields that don't fully specify a time -// =========================================================== -[FieldValue:PartialYear] ||| [Int:0-99] ||| YEAR_OF_CENTURY [Int:0-99] ||| 1.0 -[FieldValue:PartialYear] ||| ' [Int:0-99] ||| YEAR_OF_CENTURY [Int:0-99] ||| 1.0 -[FieldValue:PartialTime] ||| [FieldValue:Time] ||| [FieldValue:Time] ||| 1.0 -[FieldValue:PartialTime] ||| [FieldValue:PartOfDay] ||| [FieldValue:PartOfDay] ||| 1.0 -[FieldValue:PartialYearMonthDay] ||| [FieldValue:DayOfWeek] ||| [FieldValue:DayOfWeek] ||| 1.0 -// e.g. sabato 9 -[FieldValue:PartialYearMonthDay] ||| [FieldValue:DayOfWeek] [FieldValue:NumericDayOfMonth] ||| [FieldValue:DayOfWeek] ||| 1.0 -[FieldValue:PartialYearMonthDay] ||| [FieldValue:MonthDay] ||| [FieldValue:MonthDay] ||| 1.0 -[FieldValue:PartialYearMonthDay] ||| [FieldValue:MonthDay] [FieldValue:PartialYear] ||| [FieldValue:PartialYear] [FieldValue:MonthDay] ||| 1.0 -[FieldValue:PartialYearMonthDay] ||| [FieldValue:PartialYear] [FieldValue:MonthDay] ||| [FieldValue:PartialYear] [FieldValue:MonthDay] ||| 1.0 -[FieldValue:PartialYearMonthDay] ||| [FieldValue:MonthDay] dell [FieldValue:PartialYear] ||| [FieldValue:PartialYear] [FieldValue:MonthDay] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:PartialTime] ||| [FieldValue:PartialTime] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:PartialYearMonthDay] ||| [FieldValue:PartialYearMonthDay] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:PartialYearMonthDay] [FieldValue:PartialTime] ||| [FieldValue:PartialYearMonthDay] [FieldValue:PartialTime] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:PartialTime] [FieldValue:PartialYearMonthDay] ||| [FieldValue:PartialYearMonthDay] [FieldValue:PartialTime] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:WeekendOfWeek] ||| [FieldValue:WeekendOfWeek] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:Month] ||| [FieldValue:Month] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:MonthOfYear] ||| [FieldValue:MonthOfYear] ||| 1.0 -[FieldValue:Partial] ||| mese di [FieldValue:MonthOfYear] ||| [FieldValue:MonthOfYear] ||| 1.0 -[FieldValue:Partial] ||| mese d ' [FieldValue:MonthOfYear] ||| [FieldValue:MonthOfYear] ||| 1.0 -[FieldValue:Partial] ||| mensile di [FieldValue:MonthOfYear] ||| [FieldValue:MonthOfYear] ||| 1.0 -[FieldValue:Partial] ||| mensile d ' [FieldValue:MonthOfYear] ||| [FieldValue:MonthOfYear] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:SeasonOfYear] ||| [FieldValue:SeasonOfYear] ||| 1.0 -[FieldValue:Partial] ||| [FieldValue:QuarterOfYear] ||| [FieldValue:QuarterOfYear] ||| 1.0 - -// =============================================================== -// combinations of time fields that fully specify an absolute time -// =============================================================== -[FieldValue:Year] ||| [Int:1000-9999] ||| YEAR [Int:1000-9999] ||| 1.0 -[FieldValue:Year] ||| [Int:4Digit] ||| YEAR [Int:4Digit] ||| 1.0 -// e.g. "the year 2000" -[FieldValue:Year] ||| anno [FieldValue:Year] ||| [FieldValue:Year] ||| 1.0 -[FieldValue:Year] ||| anni [FieldValue:Year] ||| [FieldValue:Year] ||| 1.0 -[FieldValue:YearMonth] ||| [FieldValue:MonthOfYear] [FieldValue:Year] ||| [FieldValue:Year] [FieldValue:MonthOfYear] ||| 1.0 -[FieldValue:YearMonth] ||| [FieldValue:MonthOfYear] dell [FieldValue:Year] ||| [FieldValue:Year] [FieldValue:MonthOfYear] ||| 1.0 -[FieldValue:YearMonth] ||| [FieldValue:Year] [FieldValue:MonthOfYear] ||| [FieldValue:Year] [FieldValue:MonthOfYear] ||| 1.0 -[FieldValue:YearMonthDay] ||| [FieldValue:Year] [FieldValue:MonthDay] ||| [FieldValue:Year] [FieldValue:MonthDay] ||| 1.0 -[FieldValue:YearMonthDay] ||| [FieldValue:MonthDay] [FieldValue:Year] ||| [FieldValue:Year] [FieldValue:MonthDay] ||| 1.0 -[FieldValue:YearMonthDay] ||| [FieldValue:MonthDay] dell [FieldValue:Year] ||| [FieldValue:Year] [FieldValue:MonthDay] ||| 1.0 -[FieldValue:Absolute] ||| [FieldValue:Year] ||| [FieldValue:Year] ||| 1.0 -[FieldValue:Absolute] ||| [FieldValue:Year] [FieldValue:QuarterOfYear] ||| [FieldValue:Year] [FieldValue:QuarterOfYear] ||| 1.0 -[FieldValue:Absolute] ||| [FieldValue:QuarterOfYear] dell [FieldValue:Year] ||| [FieldValue:Year] [FieldValue:QuarterOfYear] ||| 1.0 -[FieldValue:Absolute] ||| [FieldValue:YearMonth] ||| [FieldValue:YearMonth] ||| 1.0 -[FieldValue:Absolute] ||| [FieldValue:YearMonthDay] ||| [FieldValue:YearMonthDay] ||| 1.0 -[FieldValue:Absolute] ||| [FieldValue:YearMonthDay] [FieldValue:Time] ||| [FieldValue:YearMonthDay] [FieldValue:Time] ||| 1.0 - -// ============================= -// expressions of simple periods -// ============================= -[Period:Singular] ||| [Unit:Singular] ||| Simple [Unit:Singular] ||| 1.0 -[Period:Amount] ||| [Int] [Unit] ||| Simple [Int] [Unit] ||| 1.0 -[Period:Amount] ||| [Int] na di [Unit] ||| Simple [Int] [Unit] ||| 1.0 -[Period:Amount] ||| [Int] na d ' [Unit] ||| Simple [Int] [Unit] ||| 1.0 -[Period:Amount] ||| le suoi [Int] [Unit] ||| Simple [Int] [Unit] ||| 1.0 -// e.g. "tre notti" -[Period:Amount] ||| [Int] mattine ||| Simple [Int] MORNINGS ||| 1.0 -[Period:Amount] ||| [Int] mattini ||| Simple [Int] MORNINGS ||| 1.0 -[Period:Amount] ||| [Int] mattinate ||| Simple [Int] MORNINGS ||| 1.0 -[Period:Amount] ||| [Int] pomeriggi ||| Simple [Int] AFTERNOONS ||| 1.0 -[Period:Amount] ||| [Int] pomeridiana ||| Simple [Int] AFTERNOONS ||| 1.0 -[Period:Amount] ||| [Int] sere ||| Simple [Int] EVENINGS ||| 1.0 -[Period:Amount] ||| [Int] serate ||| Simple [Int] EVENINGS ||| 1.0 -[Period:Amount] ||| [Int] vigilie ||| Simple [Int] EVENINGS ||| 1.0 -[Period:Amount] ||| [Int] notti ||| Simple [Int] NIGHTS ||| 1.0 -[Period:Amount] ||| [Int] nottate ||| Simple [Int] NIGHTS ||| 1.0 -[Period:Amount] ||| [Int] primavere ||| Simple [Int] SPRINGS ||| 1.0 -[Period:Amount] ||| [Int] estati ||| Simple [Int] SUMMERS ||| 1.0 -[Period:Amount] ||| [Int] estivi ||| Simple [Int] SUMMERS ||| 1.0 -[Period:Amount] ||| [Int] estive ||| Simple [Int] SUMMERS ||| 1.0 -[Period:Amount] ||| [Int] autunni ||| Simple [Int] FALLS ||| 1.0 -[Period:Amount] ||| [Int] inverni ||| Simple [Int] WINTERS ||| 1.0 -// e.g. "vent' anni" -[Period:Amount] ||| [Int] ' [Unit] ||| Simple [Int] [Unit] ||| 1.0 -// e.g. "the first nine months" -[Period:Amount] ||| primo [Int] [Unit] ||| Simple [Int] [Unit] ||| 1.0 -[Period:Amount] ||| primi [Int] [Unit] ||| Simple [Int] [Unit] ||| 1.0 -[Period:Amount] ||| quest primi [Int] [Unit] ||| Simple [Int] [Unit] ||| 1.0 -[Period:Amount] ||| quest [Int] [Unit] ||| Simple [Int] [Unit] ||| 1.0 -// e.g. "a three-year period" -[Period:Amount] ||| [Int] [Unit] periodo ||| Simple [Int] [Unit] ||| 1.0 -[Period] ||| [Period:Singular] ||| [Period:Singular] ||| 1.0 -[Period] ||| [Period:Amount] ||| [Period:Amount] ||| 1.0 -// e.g. "3 anni e 8 mesi" --> messing up with "ore e ore", need to distinguish [Period:Amount] and [Period:Plural] -[Period] ||| [Period:Amount,1] e [Period:Amount,2] ||| Sum [Period:Amount,1] [Period:Amount,2] ||| 1.0 - -[Period:Hour] ||| [Int:0-23] h ||| Simple [Int:0-23] HOURS ||| 1.0 -[Period:Minute] ||| [Int:0-59] ' ||| Simple [Int:0-59] MINUTES ||| 1.0 -[Period:Second] ||| [Int:0-59] " ||| Simple [Int:0-59] SECONDS ||| 1.0 -[Period:Second] ||| [Int:0-59] " [Int] ||| Simple [Int:0-59] SECONDS ||| 1.0 -[Period] ||| [Period:Hour] ||| [Period:Hour] ||| 1.0 -[Period] ||| [Period:Minute] ||| [Period:Minute] ||| 1.0 -[Period] ||| [Period:Second] ||| [Period:Second] ||| 1.0 -[Period] ||| [Period:Hour] [Period:Minute] ||| Sum [Period:Hour] [Period:Minute] ||| 1.0 -[Period] ||| [Period:Minute] [Period:Second] ||| Sum [Period:Minute] [Period:Second] ||| 1.0 -[Period] ||| [Period:Hour] [Period:Minute] [Period:Second] ||| Sum [Period:Hour] [Period:Minute] [Period:Second] ||| 1.0 -// e.g. 21,4 minuti -[Period] ||| [Int,1] , [Int,2] minuti ||| Sum ( Period Simple [Int,1] MINUTES ) ( Period Simple [Int,2] SECONDS ) ||| 1.0 - -// e.g. "tre lustri" -[Period:Lustri] ||| lustri ||| Simple 5 YEARS ||| 1.0 -[Period] ||| [Int] lustri ||| Multiply [Int] 5 YEARS ||| 1.0 - -// ============================================== -// expressions of periods with fractional amounts -// ============================================== -[Period] ||| [Int,1] [Int,2] / [Int,3] [Unit] ||| Fractional [Int,1] [Int,2] [Int,3] [Unit] ||| 1.0 -[Period] ||| [Unit:Singular] mezza ||| Fractional ( Int 1 ) ( Int 1 ) ( Int 2 ) [Unit:Singular] ||| 1.0 -[Period] ||| [Unit:Singular] mezzo ||| Fractional ( Int 1 ) ( Int 1 ) ( Int 2 ) [Unit:Singular] ||| 1.0 -[Period] ||| [Int] mezza [Unit] ||| Fractional [Int] ( Int 1 ) ( Int 2 ) [Unit] ||| 1.0 -[Period] ||| [Int] mezzo [Unit] ||| Fractional [Int] ( Int 1 ) ( Int 2 ) [Unit] ||| 1.0 -[Period] ||| [Int] [Unit] mezza ||| Fractional [Int] ( Int 1 ) ( Int 2 ) [Unit] ||| 1.0 -[Period] ||| [Int] [Unit] mezzo ||| Fractional [Int] ( Int 1 ) ( Int 2 ) [Unit] ||| 1.0 -[Period] ||| mezzora ||| Fractional ( Int 1 ) ( Int 2 ) HOURS ||| 1.0 -[Period] ||| mezz ' [Unit] ||| Fractional ( Int 1 ) ( Int 2 ) [Unit] ||| 1.0 -[Period] ||| mezzo [Unit] ||| Fractional ( Int 1 ) ( Int 2 ) [Unit] ||| 1.0 -[Period] ||| mezza [Unit] ||| Fractional ( Int 1 ) ( Int 2 ) [Unit] ||| 1.0 - -// ================================== -// expressions of unspecified periods -// ================================== -[Period] ||| un po ||| Unspecified UNSPECIFIED ||| 1.0 -//[Period] ||| some time ||| Unspecified UNSPECIFIED ||| 1.0 -[Period] ||| lungo periodo ||| Unspecified UNSPECIFIED ||| 1.0 -[Period] ||| alcuni [Unit] ||| Unspecified [Unit] ||| 1.0 -[Period] ||| certi [Unit] ||| Unspecified [Unit] ||| 1.0 -[Period] ||| poco [Unit] ||| Unspecified [Unit] ||| 1.0 -[Period] ||| molto [Unit] ||| Unspecified [Unit] ||| 1.0 -[Period] ||| qualche [Unit] ||| Unspecified [Unit] ||| 1.0 -[Period] ||| diverso [Unit] ||| Unspecified [Unit] ||| 1.0 -[Period] ||| parecchio [Unit] ||| Unspecified [Unit] ||| 1.0 -[Period] ||| vario [Unit] ||| Unspecified [Unit] ||| 1.0 -[Period] ||| ultimx [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 -[Period] ||| quest ultimx [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 -[Period] ||| primi [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 -[Period] ||| prime [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 -[Period] ||| prossimx [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 -// e.g. "weeks" -[Period] ||| [Unit:Plural] ||| Unspecified [Unit:Plural] ||| 1.0 - -// ========================================== -// expressions that set time period modifiers -// ========================================== -[Period] ||| quasi [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| circa [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| [Period] circa ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| pressappoco [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| pressapoco [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| intorno all [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| piu o meno [Period] ||| WithModifier [Period] APPROX ||| 1.0 -[Period] ||| meno di [Period] ||| WithModifier [Period] LESS_THAN ||| 1.0 -[Period] ||| meno d ' [Period] ||| WithModifier [Period] LESS_THAN ||| 1.0 -[Period] ||| piu di [Period] ||| WithModifier [Period] MORE_THAN ||| 1.0 -[Period] ||| piu d ' [Period] ||| WithModifier [Period] MORE_THAN ||| 1.0 -[Period] ||| poco piu di [Period] ||| WithModifier [Period] MORE_THAN ||| 1.0 -[Period] ||| poco piu d ' [Period] ||| WithModifier [Period] MORE_THAN ||| 1.0 -[Period] ||| over [Period] ||| WithModifier [Period] MORE_THAN ||| 1.0 -[Period] ||| oltre [Period] ||| WithModifier [Period] MORE_THAN ||| 1.0 -[Period] ||| sopra le [Period] ||| WithModifier [Period] EQUAL_OR_MORE ||| 1.0 -[Period] ||| non meno di [Period] ||| WithModifier [Period] EQUAL_OR_MORE ||| 1.0 -[Period] ||| non meno d ' [Period] ||| WithModifier [Period] EQUAL_OR_MORE ||| 1.0 -[Period] ||| almeno [Period] ||| WithModifier [Period] EQUAL_OR_MORE ||| 1.0 -[Period] ||| minimo [Period] ||| WithModifier [Period] EQUAL_OR_MORE ||| 1.0 -[Period] ||| dai [Period] ||| WithModifier [Period] EQUAL_OR_MORE ||| 1.0 -[Period] ||| superiore a [Period] ||| WithModifier [Period] EQUAL_OR_MORE ||| 1.0 -[Period] ||| inferiore a [Period] ||| WithModifier [Period] EQUAL_OR_LESS ||| 1.0 -[Period] ||| non piu di [Period] ||| WithModifier [Period] EQUAL_OR_LESS ||| 1.0 -[Period] ||| non piu d ' [Period] ||| WithModifier [Period] EQUAL_OR_LESS ||| 1.0 -[Period] ||| massimo [Period] ||| WithModifier [Period] EQUAL_OR_LESS ||| 1.0 -[Period] ||| fino all [Period] ||| WithModifier [Period] EQUAL_OR_LESS ||| 1.0 -[Period] ||| sotto le [Period] ||| WithModifier [Period] EQUAL_OR_LESS ||| 1.0 - -// ========================== -// expressions of period sets -// ========================== -[PeriodSet] ||| ogni ora ||| WithQuantifier ( Period Simple 1 HOURS ) EVERY ||| 1.0 -[PeriodSet] ||| quotidiano ||| WithQuantifier ( Period Simple 1 DAYS ) EVERY ||| 1.0 -[PeriodSet] ||| quotidiane ||| WithQuantifier ( Period Simple 1 DAYS ) EVERY ||| 1.0 -[PeriodSet] ||| giornaliero ||| WithQuantifier ( Period Simple 1 DAYS ) EVERY ||| 1.0 -[PeriodSet] ||| giornaliera ||| WithQuantifier ( Period Simple 1 DAYS ) EVERY ||| 1.0 -[PeriodSet] ||| quotidianamente ||| WithQuantifier ( Period Simple 1 DAYS ) EVERY ||| 1.0 -[PeriodSet] ||| giorno in giorno ||| WithQuantifier ( Period Simple 1 DAYS ) EVERY ||| 1.0 -[PeriodSet] ||| giornalmente ||| WithQuantifier ( Period Simple 1 DAYS ) EVERY ||| 1.0 -[PeriodSet] ||| settimanale ||| WithQuantifier ( Period Simple 1 WEEKS ) EVERY ||| 1.0 -[PeriodSet] ||| settimanalmente ||| WithQuantifier ( Period Simple 1 WEEKS ) EVERY ||| 1.0 -[PeriodSet] ||| mensili ||| WithQuantifier ( Period Simple 1 MONTHS ) EVERY ||| 1.0 -[PeriodSet] ||| mensile ||| WithQuantifier ( Period Simple 1 MONTHS ) EVERY ||| 1.0 -[PeriodSet] ||| mensilmente ||| WithQuantifier ( Period Simple 1 MONTHS ) EVERY ||| 1.0 -[PeriodSet] ||| quarto mese ||| WithQuantifier ( Period Simple 4 MONTHS ) EVERY ||| 1.0 -[PeriodSet] ||| trimestrale ||| WithQuantifier ( Period Simple 1 QUARTER_YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| trimestralmente ||| WithQuantifier ( Period Simple 1 QUARTER_YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| annuale ||| WithQuantifier ( Period Simple 1 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| annuo ||| WithQuantifier ( Period Simple 1 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| annualmente ||| WithQuantifier ( Period Simple 1 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| annuali ||| WithQuantifier ( Period Simple 1 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| annualizzato ||| WithQuantifier ( Period Simple 1 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| annualizzata ||| WithQuantifier ( Period Simple 1 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| annui ||| WithQuantifier ( Period Simple 1 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| annua ||| WithQuantifier ( Period Simple 1 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| biennali ||| WithQuantifier ( Period Simple 2 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| biennale ||| WithQuantifier ( Period Simple 2 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| biennio ||| WithQuantifier ( Period Simple 2 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| triennale ||| WithQuantifier ( Period Simple 3 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| triennio ||| WithQuantifier ( Period Simple 3 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| quadriennale ||| WithQuantifier ( Period Simple 4 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| decennale ||| WithQuantifier ( Period Simple 10 YEARS ) EVERY ||| 1.0 -[PeriodSet] ||| ventennale ||| WithQuantifier ( Period Simple 20 YEARS ) EVERY ||| 1.0 - -// e.g. "invernale" -[PeriodSet] ||| invernale ||| WithQuantifier ( Period Simple 1 WINTERS ) EVERY ||| 1.0 - -[PeriodSet] ||| tutti le mattine ||| WithQuantifier ( Period Simple 1 MORNINGS ) EVERY ||| 1.0 -[PeriodSet] ||| tutti le mattini ||| WithQuantifier ( Period Simple 1 MORNINGS ) EVERY ||| 1.0 -[PeriodSet] ||| tutti le mattinate ||| WithQuantifier ( Period Simple 1 MORNINGS ) EVERY ||| 1.0 -[PeriodSet] ||| tutti le pomeriggi ||| WithQuantifier ( Period Simple 1 AFTERNOONS ) EVERY ||| 1.0 -[PeriodSet] ||| tutti le pomeridiana ||| WithQuantifier ( Period Simple 1 AFTERNOONS ) EVERY ||| 1.0 -[PeriodSet] ||| tutti le sere ||| WithQuantifier ( Period Simple 1 EVENINGS ) EVERY ||| 1.0 -[PeriodSet] ||| tutti le serate ||| WithQuantifier ( Period Simple 1 EVENINGS ) EVERY ||| 1.0 -[PeriodSet] ||| tutti le vigilie ||| WithQuantifier ( Period Simple 1 EVENINGS ) EVERY ||| 1.0 -[PeriodSet] ||| tutti le notti ||| WithQuantifier ( Period Simple 1 NIGHTS ) EVERY ||| 1.0 -[PeriodSet] ||| tutti le nottate ||| WithQuantifier ( Period Simple 1 NIGHTS ) EVERY ||| 1.0 -[PeriodSet] ||| tutti le primavere ||| WithQuantifier ( Period Simple 1 SPRINGS ) EVERY ||| 1.0 -[PeriodSet] ||| tutti le estati ||| WithQuantifier ( Period Simple 1 SUMMERS ) EVERY ||| 1.0 -[PeriodSet] ||| tutti le estivi ||| WithQuantifier ( Period Simple 1 SUMMERS ) EVERY ||| 1.0 -[PeriodSet] ||| tutti le estive ||| WithQuantifier ( Period Simple 1 SUMMERS ) EVERY ||| 1.0 -[PeriodSet] ||| tutti le autunni ||| WithQuantifier ( Period Simple 1 FALLS ) EVERY ||| 1.0 -[PeriodSet] ||| tutti le inverni ||| WithQuantifier ( Period Simple 1 WINTERS ) EVERY ||| 1.0 - -[PeriodSet] ||| tutti le [Period] ||| WithQuantifier [Period] EVERY ||| 1.0 -[PeriodSet] ||| ogni [Period] ||| WithQuantifier [Period] EACH ||| 1.0 -[PeriodSet] ||| ciascun [Period] ||| WithQuantifier [Period] EACH ||| 1.0 - -//TODO: confirm this -//[PeriodSet] ||| ennesima [Period] ||| WithQuantifier [Period] EACH ||| 1.0 -[PeriodSet] ||| volta all [Period] ||| WithQuantifier [Period] EACH ||| 1.0 -[PeriodSet] ||| volta all ' [Period] ||| WithQuantifier [Period] EACH ||| 1.01.0 -[PeriodSet] ||| [Int] volta all [Period] ||| WithQuantifier [Period] EACH ||| 1.0 -[PeriodSet] ||| [Int] volta all ' [Period] ||| WithQuantifier [Period] EACH ||| 1.0 -[PeriodSet] ||| [Int] volte all [Period] ||| WithQuantifier [Period] EACH ||| 1.0 -[PeriodSet] ||| [Int] volte all ' [Period] ||| WithQuantifier [Period] EACH ||| 1.0 -[PeriodSet] ||| [Period] all [Unit] ||| WithQuantifier [Period] EACH ||| 1.0 -[PeriodSet] ||| [Period] all ' [Unit] ||| WithQuantifier [Period] EACH ||| 1.0 -[PeriodSet] ||| [Period] dell [Unit] ||| WithQuantifier [Period] EACH ||| 1.0 -[PeriodSet] ||| [Period] dell ' [Unit] ||| WithQuantifier [Period] EACH ||| 1.0 - -// e.g. "quattro ore tutti le mattine" -[PeriodSet] ||| [Period] [PeriodSet] ||| [PeriodSet] ||| 1.0 - -// ======================================= -// time spans are either :Solo or :Regular -// ======================================= -[TimeSpan] ||| [TimeSpan:Solo] ||| [TimeSpan:Solo] ||| 1.0 -[TimeSpan] ||| [TimeSpan:Regular] ||| [TimeSpan:Regular] ||| 1.0 - -// ============================================================== -// expressions of time spans that can't be combined with anything -// ============================================================== -[TimeSpan:Solo] ||| passatx ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| in passatx ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| quell momento ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| suo tempo ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| recente ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| recentissima ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| recenti ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| recentemente ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| ultimamente ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| di recente ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| negli ultimx tempi ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| da poco ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| scorsx ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| prima ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| qualche tempo fa ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| ex ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| poco fa ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| recente passato ||| Simple PAST ||| 1.0 -[TimeSpan:Solo] ||| presente ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| ora ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| adesso ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| attualmente ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| tuttora ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| finora ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| sinora ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| fin d ' ora ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| tutti quest anni ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| attuale ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| attuali ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| corrente ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| correntemente ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| all momento ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| quest momento ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| allora ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| all quest punto ||| Simple PRESENT ||| 1.0 -[TimeSpan:Solo] ||| in futurx ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| futurx ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| presto ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| appena ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| subito ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| prossimamente ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| fra poco ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| fra breve ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| prossimx ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| all piu presto ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| dopo ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| all dopo ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| piu tardi ||| Simple FUTURE ||| 1.0 -[TimeSpan:Solo] ||| ora in avanti ||| Simple FUTURE ||| 1.0 -// e.g. "the long term" -//[TimeSpan:Solo] ||| the term ||| Simple FUTURE ||| 1.0 - -// ================================== -// expressions of absolute time spans -// ================================== -[TimeSpan:Regular] ||| [FieldValue:Absolute] ||| FindAbsolute [FieldValue:Absolute] ||| 1.0 -// e.g. "1980s" -[TimeSpan:Regular] ||| [FieldValue:Year] s ||| FindEnclosing ( TimeSpan FindAbsolute [FieldValue:Year] ) DECADES ||| 1.0 -// e.g. "19th century" - requires special handing because, e.g. "19th century" = "18" -[TimeSpan:Regular] ||| [Int] ° secolo ||| EndAtStartOf ( TimeSpan FindAbsolute ( FieldValue CENTURY [Int] ) ) ( Period Simple 1 CENTURIES ) ||| 1.0 -// e.g. "ottocento", "novecento" -[TimeSpan:Regular] ||| due cento ||| FindAbsolute ( FieldValue CENTURY 12 ) ||| 1.0 -[TimeSpan:Regular] ||| tre cento ||| FindAbsolute ( FieldValue CENTURY 13 ) ||| 1.0 -[TimeSpan:Regular] ||| quattro cento ||| FindAbsolute ( FieldValue CENTURY 14 ) ||| 1.0 -[TimeSpan:Regular] ||| cinque cento ||| FindAbsolute ( FieldValue CENTURY 15 ) ||| 1.0 -[TimeSpan:Regular] ||| sei cento ||| FindAbsolute ( FieldValue CENTURY 16 ) ||| 1.0 -[TimeSpan:Regular] ||| sette cento ||| FindAbsolute ( FieldValue CENTURY 17 ) ||| 1.0 -[TimeSpan:Regular] ||| otto cento ||| FindAbsolute ( FieldValue CENTURY 18 ) ||| 1.0 -[TimeSpan:Regular] ||| nove cento ||| FindAbsolute ( FieldValue CENTURY 19 ) ||| 1.0 - -// ================================= -// expressions of current time spans -// ================================= -//[TimeSpan:Regular] ||| ora ||| Simple PRESENT ||| 1.0 -[TimeSpan:Regular] ||| momento ||| Simple PRESENT ||| 1.0 -[TimeSpan:Regular] ||| quest [Unit:Plural] ||| Simple PRESENT ||| 1.0 -[TimeSpan:Regular] ||| oggi ||| FindEnclosing PRESENT DAYS ||| 1.0 -[TimeSpan:Regular] ||| quell data ||| FindEnclosing PRESENT DAYS ||| 1.0 -[TimeSpan:Regular] ||| stamattina ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT DAYS ) ( FieldValue MORNING_OF_DAY 1 ) ||| 1.0 -[TimeSpan:Regular] ||| stamani ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT DAYS ) ( FieldValue MORNING_OF_DAY 1 ) ||| 1.0 -[TimeSpan:Regular] ||| stamane ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT DAYS ) ( FieldValue MORNING_OF_DAY 1 ) ||| 1.0 -[TimeSpan:Regular] ||| stasera ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT DAYS ) ( FieldValue EVENING_OF_DAY 1 ) ||| 1.0 -[TimeSpan:Regular] ||| stanotte ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT DAYS ) ( FieldValue NIGHT_OF_DAY 1 ) ||| 1.0 -[TimeSpan:Regular] ||| quest [Unit:Singular] ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -[TimeSpan:Regular] ||| quest ' [Unit:Singular] ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -[TimeSpan:Regular] ||| quell [Unit:Singular] ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -[TimeSpan:Regular] ||| quell ' [Unit:Singular] ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -[TimeSpan:Regular] ||| stesso [Unit:Singular] ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -[TimeSpan:AllowsThis] ||| stesso giorno ||| FindEnclosing PRESENT DAYS ||| 1.0 -// e.g. "the current week" -[TimeSpan:Regular] ||| [Unit:Singular] in corso ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -[TimeSpan:Regular] ||| [Unit:Singular] corrente ||| FindEnclosing PRESENT [Unit:Singular] ||| 1.0 -// e.g. "this evening" -[TimeSpan:Regular] ||| quest [FieldValue:Partial] ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT [FieldValue:Partial] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| quest ' [FieldValue:Partial] ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT [FieldValue:Partial] ) [FieldValue:Partial] ||| 1.0 -// e.g. "January this year" -[TimeSpan:Regular] ||| [FieldValue:Partial] quest [Unit] ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT [Unit] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] quest ' [Unit] ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT [Unit] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] di quest [Unit] ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT [Unit] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] di quest ' [Unit] ||| FindEnclosed ( TimeSpan FindEnclosing PRESENT [Unit] ) [FieldValue:Partial] ||| 1.0 - -// ================================= -// expressions of earlier time spans -// ================================= -[TimeSpan:Regular] ||| ieri ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 1 DAYS ) ||| 1.0 -[TimeSpan:Regular] ||| giornata di ieri ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 1 DAYS ) ||| 1.0 -[TimeSpan:Regular] ||| altroieri ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 2 DAYS ) ||| 1.0 -[TimeSpan:Regular] ||| altro ieri ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 2 DAYS ) ||| 1.0 -// e.g. "last October" -[TimeSpan:AllowsThis] ||| scorsx [FieldValue:Partial] ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| [FieldValue:Partial] scorsx ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| [FieldValue:Partial] passatx ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| [FieldValue:Partial] passatx ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| ultimx [FieldValue:Partial] ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| [FieldValue:Partial] ultimx ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| precedentx [FieldValue:Partial] ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| [FieldValue:Partial] precedentx ||| FindEarlier PRESENT [FieldValue:Partial] ||| 1.0 -// e.g. "the last three weeks", "almost four years ago" -[TimeSpan:AllowsThis] ||| precedentx [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] precedentx ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| scorsx [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] scorsx ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| passatx [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] passatx ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| ultimx [Period] ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] ultimx ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -// e.g. "three years earlier" -[TimeSpan:Regular] ||| [Period] prima ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:Regular] ||| [Period] fa ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:Regular] ||| [Period] addietro ||| EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -// alternate interpretation: exactly [Period] earlier -[TimeSpan:Regular] ||| [Period] prima ||| MoveEarlier PRESENT [Period] ||| 1.0 -[TimeSpan:Regular] ||| [Period] fa ||| MoveEarlier PRESENT [Period] ||| 1.0 -[TimeSpan:Regular] ||| [Period] addietro ||| MoveEarlier PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| precedentx [Period] ||| MoveEarlier PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] precedentx ||| MoveEarlier PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| scorsx [Period] ||| MoveEarlier PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] scorsx ||| MoveEarlier PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| passatx [Period] ||| MoveEarlier PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] passatx ||| MoveEarlier PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| ultimx [Period] ||| MoveEarlier PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] ultimx ||| MoveEarlier PRESENT [Period] ||| 1.0 -// e.g. "the day before last Tuesday" -[TimeSpan:Regular] ||| [Period] prima [TimeSpan:Regular] ||| EndAtStartOf ( TimeSpan FindEnclosing [TimeSpan:Regular] [Period] ) [Period] ||| 1.0 -// e.g. "January last year" -[TimeSpan:Regular] ||| [FieldValue:Partial] dell scorsx [Unit] ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell [Unit] scorsx ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell ' [Unit] scorsx ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] scorsx [Unit] ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell ' ultimx [Unit] ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell [Unit] ultimx ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell ' [Unit] ultimx ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] ultimx [Unit] ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell precedentx [Unit] ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell [Unit] precedentx ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell ' [Unit] precedentx ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] precedentx [Unit] ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -// e.g. "the year-ago third quarter" -[TimeSpan:Regular] ||| [Period] fa [FieldValue:Partial] ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [Period] prima [FieldValue:Partial] ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ) [FieldValue:Partial] ||| 1.0 - -// =============================== -// expressions of later time spans -// =============================== -[TimeSpan:Regular] ||| domani ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 1 DAYS ) ||| 1.0 -[TimeSpan:Regular] ||| indomani ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 1 DAYS ) ||| 1.0 -[TimeSpan:Regular] ||| dopodomani ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 2 DAYS ) ||| 1.0 -[TimeSpan:Regular] ||| dopo domani ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 2 DAYS ) ||| 1.0 -// e.g. "next Tuesday" -[TimeSpan:AllowsThis] ||| prossimx [FieldValue:Partial] ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| [FieldValue:Partial] prossimx ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| venturx [FieldValue:Partial] ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| [FieldValue:Partial] venturx ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| successivx [FieldValue:Partial] ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| [FieldValue:Partial] successivx ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| seguentx [FieldValue:Partial] ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| [FieldValue:Partial] seguentx ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| entrantx [FieldValue:Partial] ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:AllowsThis] ||| [FieldValue:Partial] entrantx ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 -// e.g. "next year" -[TimeSpan:AllowsThis] ||| prossimx [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] prossimx ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| venturx [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] venturx ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| futurx [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] futurx ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| successivx [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] successivx ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| seguentx [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] seguentx ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| entrantx [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] entrantx ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| tra [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| fra [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| tra circa [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -// e.g. "two days later" -[TimeSpan:Regular] ||| [Period] dopo ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -// alternate interpretation: exactly [Period] earlier -[TimeSpan:Regular] ||| [Period] dopo ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| prossimx [Period] ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] prossimx ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| venturx [Period] ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] venturx ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| futurx [Period] ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] futurx ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| successivx [Period] ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] successivx ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| seguentx [Period] ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] seguentx ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| entrantx [Period] ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| [Period] entrantx ||| MoveLater PRESENT [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| tra [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| fra [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -[TimeSpan:AllowsThis] ||| tra circa [Period] ||| StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Period] ) [Period] ||| 1.0 -// e.g. "January next year" -[TimeSpan:Regular] ||| [FieldValue:Partial] dell prossimx [Unit] ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell [Unit] prossimx ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell ' [Unit] prossimx ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] prossimx [Unit] ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell venturx [Unit] ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell [Unit] venturx ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell ' [Unit] venturx ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] venturx [Unit] ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell futurx [Unit] ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell [Unit] futurx ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell ' [Unit] futurx ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] futurx [Unit] ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell successivx [Unit] ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell [Unit] successivx ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell ' [Unit] successivx ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] successivx [Unit] ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell seguentx [Unit] ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell [Unit] seguentx ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell ' [Unit] seguentx ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] seguentx [Unit] ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell ' entrantx [Unit] ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell [Unit] entrantx ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell ' [Unit] entrantx ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] entrantx [Unit] ||| FindEnclosed ( TimeSpan StartAtEndOf ( TimeSpan FindEnclosing PRESENT [Unit] ) ( Period Simple 1 [Unit] ) ) [FieldValue:Partial] ||| 1.0 - -// ==================================================================================== -// allows rules tagged with :AllowsThis to be prefixed by "this" or "that" (or nothing) -// ==================================================================================== -[TimeSpan:Regular] ||| [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| quest [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| quest ' [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| quell [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| quell ' [TimeSpan:AllowsThis] ||| [TimeSpan:AllowsThis] ||| 1.0 -[TimeSpan:Regular] ||| stesso [TimeSpan:Regular] ||| [TimeSpan:Regular] ||| 1.0 -[TimeSpan:Regular] ||| quest [TimeSpan:Regular] ||| [TimeSpan:Regular] ||| 1.0 -[TimeSpan:Regular] ||| quest ' [TimeSpan:Regular] ||| [TimeSpan:Regular] ||| 1.0 -[TimeSpan:Regular] ||| quell [TimeSpan:Regular] ||| [TimeSpan:Regular] ||| 1.0 -[TimeSpan:Regular] ||| quell ' [TimeSpan:Regular] ||| [TimeSpan:Regular] ||| 1.0 -[TimeSpan:Regular] ||| stesso [TimeSpan:Regular] ||| [TimeSpan:Regular] ||| 1.0 - -// ========================================== -// expressions that could be earlier or later -// ========================================== -// e.g. "Friday", "the weekend", "October 11" -[TimeSpan:Regular] ||| [FieldValue:Partial] ||| FindAtOrEarlier PRESENT [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] ||| FindLater PRESENT [FieldValue:Partial] ||| 1.0 - -// ======================================================================== -// expressions that could be earlier or later (but we assume to be earlier) -// ======================================================================== -// e.g. "anni '80" -[TimeSpan:Regular] ||| anni [Int:Tens] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY [Int:Tens] ) ||| 1.0 - -[TimeSpan:Regular] ||| anni [Int:10-10] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 1 ) ||| 1.0 -[TimeSpan:Regular] ||| anni [Int:20-20] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 2 ) ||| 1.0 -[TimeSpan:Regular] ||| anni [Int:30-30] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 3 ) ||| 1.0 -[TimeSpan:Regular] ||| anni [Int:40-40] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 4 ) ||| 1.0 -[TimeSpan:Regular] ||| anni [Int:50-50] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 5 ) ||| 1.0 -[TimeSpan:Regular] ||| anni [Int:60-60] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 6 ) ||| 1.0 -[TimeSpan:Regular] ||| anni [Int:70-70] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 7 ) ||| 1.0 -[TimeSpan:Regular] ||| anni [Int:80-80] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 8 ) ||| 1.0 -[TimeSpan:Regular] ||| anni [Int:90-90] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 9 ) ||| 1.0 -[TimeSpan:Regular] ||| anni ' [Int:10-10] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 1 ) ||| 1.0 -[TimeSpan:Regular] ||| anni ' [Int:20-20] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 2 ) ||| 1.0 -[TimeSpan:Regular] ||| anni ' [Int:30-30] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 3 ) ||| 1.0 -[TimeSpan:Regular] ||| anni ' [Int:40-40] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 4 ) ||| 1.0 -[TimeSpan:Regular] ||| anni ' [Int:50-50] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 5 ) ||| 1.0 -[TimeSpan:Regular] ||| anni ' [Int:60-60] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 6 ) ||| 1.0 -[TimeSpan:Regular] ||| anni ' [Int:70-70] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 7 ) ||| 1.0 -[TimeSpan:Regular] ||| anni ' [Int:80-80] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 8 ) ||| 1.0 -[TimeSpan:Regular] ||| anni ' [Int:90-90] ||| FindAtOrEarlier PRESENT ( FieldValue DECADE_OF_CENTURY 9 ) ||| 1.0 - -[TimeSpan:Regular] ||| anno ' [Int:0-99] ||| FindAtOrEarlier PRESENT ( FieldValue YEAR_OF_CENTURY [Int:0-99] ) ||| 1.0 -[TimeSpan:Regular] ||| ' [Int:0-99] ||| FindAtOrEarlier PRESENT ( FieldValue YEAR_OF_CENTURY [Int:0-99] ) ||| 1.0 -[TimeSpan:Regular] ||| [Int:60-99] ||| FindAtOrEarlier PRESENT ( FieldValue YEAR_OF_CENTURY [Int:60-99] ) ||| 1.0 -[TimeSpan:Regular] ||| [Int:2Digit] ||| FindAtOrEarlier PRESENT ( FieldValue YEAR_OF_CENTURY [Int:2Digit] ) ||| 1.0 - -// ========================================== -// expressions changing time span granularity -// ========================================== -// e.g. "the week of March 6" -[TimeSpan:Regular] ||| [Unit:Singular] dell [TimeSpan:Regular] ||| FindEnclosing [TimeSpan:Regular] [Unit:Singular] ||| 1.0 -[TimeSpan:Regular] ||| [Unit:Singular] dell ' [TimeSpan:Regular] ||| FindEnclosing [TimeSpan:Regular] [Unit:Singular] ||| 1.0 -// e.g. "the quarter a year ago", "the period last year" -[TimeSpan:Regular] ||| [Unit:Singular] [TimeSpan:Regular] ||| FindEnclosing [TimeSpan:Regular] [Unit:Singular] ||| 1.0 -// e.g. "Thanksgiving day" -[TimeSpan:Regular] ||| [TimeSpan:Regular] [Unit:Singular] ||| FindEnclosing [TimeSpan:Regular] [Unit:Singular] ||| 1.0 -// e.g. "mid-afternoon yesterday", "domani sera" -[TimeSpan:Regular] ||| [FieldValue:PartOfDay] [TimeSpan:Regular] ||| FindEnclosed [TimeSpan:Regular] [FieldValue:PartOfDay] ||| 1.0 -[TimeSpan:Regular] ||| [TimeSpan:Regular] [FieldValue:PartOfDay] ||| FindEnclosed [TimeSpan:Regular] [FieldValue:PartOfDay] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:PartOfDay] prima ||| FindEnclosed ( TimeSpan EndAtStartOf ( TimeSpan FindEnclosing PRESENT DAYS ) ( Period Simple 1 DAYS ) ) [FieldValue:PartOfDay] ||| 1.0 -// e.g. "winter of 1994", "ultimo trimestre dell'anno precedente" -[TimeSpan:Regular] ||| [FieldValue:Partial] dell [TimeSpan:Regular] ||| FindEnclosed [TimeSpan:Regular] [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] dell ' [TimeSpan:Regular] ||| FindEnclosed [TimeSpan:Regular] [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] [TimeSpan:Regular] ||| FindEnclosed [TimeSpan:Regular] [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [TimeSpan:Regular] [FieldValue:Partial] ||| FindEnclosed [TimeSpan:Regular] [FieldValue:Partial] ||| 1.0 -// e.g. "this year's third quarter" -[TimeSpan:Regular] ||| [FieldValue:Partial] di [TimeSpan:Regular] ||| FindEnclosed [TimeSpan:Regular] [FieldValue:Partial] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:Partial] d ' [TimeSpan:Regular] ||| FindEnclosed [TimeSpan:Regular] [FieldValue:Partial] ||| 1.0 -// e.g. "23 di lunedì" -[TimeSpan:Regular] ||| [FieldValue:Time] di [TimeSpan:Regular] ||| FindEnclosed [TimeSpan:Regular] [FieldValue:Time] ||| 1.0 -[TimeSpan:Regular] ||| [FieldValue:HourOfDay] ora italiana di [TimeSpan:Regular] ||| FindEnclosed [TimeSpan:Regular] [FieldValue:HourOfDay] ||| 1.0 - -// ======================================== -// expressions that set time span modifiers -// ======================================== -[TimeSpan:Regular] ||| fine dell [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) END ||| 1.0 -[TimeSpan:Regular] ||| fine dell ' [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) END ||| 1.0 -[TimeSpan:Regular] ||| fine [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) END ||| 1.0 -[TimeSpan:Regular] ||| fine di [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) END ||| 1.0 -[TimeSpan:Regular] ||| fine d ' [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) END ||| 1.0 -[TimeSpan:Regular] ||| fin d ' [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) END ||| 1.0 -[TimeSpan:Regular] ||| fine dell [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 -[TimeSpan:Regular] ||| fine dell ' [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 -[TimeSpan:Regular] ||| fine [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 -[TimeSpan:Regular] ||| fine di [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 -[TimeSpan:Regular] ||| fine d ' [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 -[TimeSpan:Regular] ||| fin d ' [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 - -[TimeSpan:Regular] ||| inizio dell [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) START ||| 1.0 -[TimeSpan:Regular] ||| inizio dell ' [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) START ||| 1.0 -[TimeSpan:Regular] ||| inizio [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) START ||| 1.0 -[TimeSpan:Regular] ||| inizio di [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) START ||| 1.0 -[TimeSpan:Regular] ||| inizio d ' [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) START ||| 1.0 -//[TimeSpan:Regular] ||| primo [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) START ||| 1.0 -//[TimeSpan:Regular] ||| prima [Unit] ||| WithModifier ( TimeSpan FindEnclosing PRESENT [Unit] ) START ||| 1.0 -[TimeSpan:Regular] ||| inizio dell [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| inizio dell ' [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| inizio [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| inizio di [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| inizio d ' [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| primi di [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| primi d ' [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| primi [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| primo di [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| primo d ' [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -[TimeSpan:Regular] ||| primo [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 -// don't allow this to combine with other rules, since "earlier" can play many roles -[TimeSpan:Regular] ||| in precedenza in [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] START ||| 1.0 - -[TimeSpan:Regular] ||| meta [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] MID ||| 1.0 -[TimeSpan:Regular] ||| meta di [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] MID ||| 1.0 -[TimeSpan:Regular] ||| meta d ' [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] MID ||| 1.0 -[TimeSpan:Regular] ||| meta dell [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] MID ||| 1.0 -[TimeSpan:Regular] ||| meta dell ' [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] MID ||| 1.0 - -[TimeSpan:Regular] ||| tardo [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 -[TimeSpan:Regular] ||| tardi [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 -[TimeSpan:Regular] ||| piu tardi in [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 -[TimeSpan:Regular] ||| termine dell [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] END ||| 1.0 -[TimeSpan:Regular] ||| quasi [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| circa [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| intorno [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -//[TimeSpan:Regular] ||| verso [FieldValue:Time] ||| WithModifier ( TimeSpan FindAbsolute [FieldValue:Time] ) APPROX ||| 1.0 -[TimeSpan:Regular] ||| [TimeSpan:Regular] circa ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| [TimeSpan:Regular] dintorni ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| piu o meno [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] APPROX ||| 1.0 -[TimeSpan:Regular] ||| post [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] AFTER ||| 1.0 -[TimeSpan:Regular] ||| piu di [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] AFTER ||| 1.0 -[TimeSpan:Regular] ||| piu d ' [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] AFTER ||| 1.0 -[TimeSpan:Regular] ||| poco piu di [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] AFTER ||| 1.0 -[TimeSpan:Regular] ||| poco piu d ' [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] AFTER ||| 1.0 -[TimeSpan:Regular] ||| oltre [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] BEFORE ||| 1.0 -[TimeSpan:Regular] ||| non meno di [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] ON_OR_AFTER ||| 1.0 -[TimeSpan:Regular] ||| non meno d ' [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] ON_OR_AFTER ||| 1.0 -[TimeSpan:Regular] ||| meno di [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] ON_OR_BEFORE ||| 1.0 -[TimeSpan:Regular] ||| meno d ' [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] ON_OR_BEFORE ||| 1.0 -[TimeSpan:Regular] ||| almeno [TimeSpan:Regular] ||| WithModifier [TimeSpan:Regular] ON_OR_BEFORE ||| 1.0 - -// ================================================= -// expressions of fields used only by time span sets -// ================================================= -[FieldValue:Unspecified] ||| mattine ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| mattini ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| mattinate ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| alba ||| MORNING_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| pomeriggi ||| AFTERNOON_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| pomeridiana ||| AFTERNOON_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| sere ||| EVENING_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| serate ||| EVENING_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| vigilie ||| EVENING_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| notti ||| NIGHT_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| nottate ||| NIGHT_OF_DAY 1 ||| 1.0 -[FieldValue:Unspecified] ||| primavere ||| SPRING_OF_YEAR 1 ||| 1.0 -[FieldValue:Unspecified] ||| estati ||| SUMMER_OF_YEAR 1 ||| 1.0 -[FieldValue:Unspecified] ||| estivi ||| SUMMER_OF_YEAR 1 ||| 1.0 -[FieldValue:Unspecified] ||| estive ||| SUMMER_OF_YEAR 1 ||| 1.0 -[FieldValue:Unspecified] ||| autunni ||| FALL_OF_YEAR 1 ||| 1.0 -[FieldValue:Unspecified] ||| inverni ||| WINTER_OF_YEAR 1 ||| 1.0 - -// ============================= -// expressions of time span sets -// ============================= -// e.g. "each Thursday" -[TimeSpanSet] ||| ogni [FieldValue:Partial] ||| Simple [FieldValue:Partial] ||| 1.0 -[TimeSpanSet] ||| tutti le [FieldValue:Partial] ||| Simple [FieldValue:Partial] ||| 1.0 -[TimeSpanSet] ||| giorno di [FieldValue:DayOfWeek] ||| Simple [FieldValue:DayOfWeek] ||| 1.0 -// e.g. "una domenica al mese" -[TimeSpanSet] ||| [FieldValue:Partial] all [Unit] ||| Simple [FieldValue:Partial] ||| 1.0 -[TimeSpanSet] ||| [FieldValue:Partial] all ' [Unit] ||| Simple [FieldValue:Partial] ||| 1.0 -// e.g. "Tuesday nights" -[TimeSpanSet] ||| [FieldValue:Partial] [FieldValue:Unspecified] ||| Simple ( FieldValue [FieldValue:Partial] [FieldValue:Unspecified] ) ||| 1.0 -// e.g. "the past three summers" -[TimeSpanSet] ||| ultimx [Int] [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -// e.g. "fourth quarters" -[TimeSpanSet] ||| [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 -// e.g. "mesi estivi" -[TimeSpanSet] ||| mesi [FieldValue:Unspecified] ||| Simple [FieldValue:Unspecified] ||| 1.0 diff --git a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/label/non-operator.txt b/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/label/non-operator.txt deleted file mode 100755 index b4a8da1..0000000 --- a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/label/non-operator.txt +++ /dev/null @@ -1,17 +0,0 @@ -Period -Year -Calendar-Interval -Month-Of-Year -Day-Of-Month -Day-Of-Week -Hour-Of-Day -Minute-Of-Hour -Number -Second-Of-Minute -Time-Zone -Part-Of-Day -Season-Of-Year -AMPM-Of-Day -Part-Of-Week -Week-Of-Year -Two-Digit-Year \ No newline at end of file diff --git a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/label/operator.txt b/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/label/operator.txt deleted file mode 100755 index 26fd5dc..0000000 --- a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/label/operator.txt +++ /dev/null @@ -1,14 +0,0 @@ -Sum -Difference -Union -Intersection -Every-Nth -This -Last -Next -Before -After -Between -NthFromStart -NthFromEnd -Frequency \ No newline at end of file diff --git a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/linking_configure/between-indicators.txt b/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/linking_configure/between-indicators.txt deleted file mode 100755 index 26abc6a..0000000 --- a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/linking_configure/between-indicators.txt +++ /dev/null @@ -1,4 +0,0 @@ -Start from -Start since -End to -End until diff --git a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/linking_configure/date-types.txt b/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/linking_configure/date-types.txt deleted file mode 100755 index 6071593..0000000 --- a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/linking_configure/date-types.txt +++ /dev/null @@ -1,124 +0,0 @@ -AMPM-Of-Day AM am -AMPM-Of-Day AM a.m. -AMPM-Of-Day PM pm -AMPM-Of-Day PM p.m. -Calendar-Interval Century century -Calendar-Interval Day daily -Calendar-Interval Day day -Calendar-Interval Day days -Calendar-Interval Day eve -Calendar-Interval Day today -Calendar-Interval Day tomorrow -Calendar-Interval Day yesterday -Calendar-Interval Month month -Calendar-Interval Month months -Calendar-Interval Quarter-Year quarter -Calendar-Interval Quarter-Year quarterly -Calendar-Interval Week week -Calendar-Interval Year annual -Calendar-Interval Year year -Calendar-Interval Year years -Calendar-Interval Hour hour -Calendar-Interval Hour hours -Calendar-Interval Hour hrs -Calendar-Interval Minute minute -Calendar-Interval Minute minutes -Calendar-Interval Minute min -Calendar-Interval Second second -Calendar-Interval Second seconds -Calendar-Interval Second sec -Day-Of-Week Friday friday -Day-Of-Week Monday monday -Day-Of-Week Saturday saturday -Day-Of-Week Sunday sunday -Day-Of-Week Thursday thursday -Day-Of-Week Tuesday tuesday -Day-Of-Week Wednesday wednesday -Month-Of-Year April 04 -Month-Of-Year April 4 -Month-Of-Year April apr. -Month-Of-Year April apr -Month-Of-Year April april -Month-Of-Year August 08 -Month-Of-Year August 8 -Month-Of-Year August aug. -Month-Of-Year August aug -Month-Of-Year August august -Month-Of-Year December 12 -Month-Of-Year December dec. -Month-Of-Year December dec -Month-Of-Year December december -Month-Of-Year February 02 -Month-Of-Year February 2 -Month-Of-Year February feb. -Month-Of-Year February feb -Month-Of-Year February february -Month-Of-Year January 01 -Month-Of-Year January 1 -Month-Of-Year January jan. -Month-Of-Year January jan -Month-Of-Year January january -Month-Of-Year July 07 -Month-Of-Year July 7 -Month-Of-Year July jul. -Month-Of-Year July jul -Month-Of-Year July july -Month-Of-Year June 06 -Month-Of-Year June 6 -Month-Of-Year June jun. -Month-Of-Year June jun -Month-Of-Year June june -Month-Of-Year March 03 -Month-Of-Year March 3 -Month-Of-Year March mar. -Month-Of-Year March mar -Month-Of-Year March march -Month-Of-Year May 05 -Month-Of-Year May 5 -Month-Of-Year May may -Month-Of-Year November 11 -Month-Of-Year November nov. -Month-Of-Year November nov -Month-Of-Year November november -Month-Of-Year October 10 -Month-Of-Year October oct. -Month-Of-Year October oct -Month-Of-Year October october -Month-Of-Year September 09 -Month-Of-Year September 9 -Month-Of-Year September sep. -Month-Of-Year September sep -Month-Of-Year September september -Part-Of-Day Afternoon afternoon -Part-Of-Day Evening evening -Part-Of-Day Morning morning -Part-Of-Day Night night -Part-Of-Day Night nights -Part-Of-Day Noon noon -Part-Of-Week Weekend weekend -Period Centuries centuries -Period Centuries century -Period Days day -Period Days days -Period Decades decade -Period Decades decades -Period Hours hour -Period Hours hours -Period Hours hrs -Period Minutes minute -Period Minutes minutes -Period Minutes min -Period Seconds second -Period Seconds seconds -Period Seconds sec -Period Months month -Period Months months -Period Weeks week -Period Weeks weeks -Period Years year -Period Years years -Season-Of-Year Fall fall -Season-Of-Year Spring spring -Season-Of-Year Summer summer -Season-Of-Year Summer summers -Season-Of-Year Winter winter diff --git a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/linking_configure/timeml-schema.xml b/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/linking_configure/timeml-schema.xml deleted file mode 100755 index a3db341..0000000 --- a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/linking_configure/timeml-schema.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - OCCURRENCE,PERCEPTION,REPORTING,ASPECTUAL,STATE,I_STATE,I_ACTION - - - - - - - DATE,TIME,DURATION,SET - CREATION_TIME,EXPIRATION_TIME,MODIFICATION_TIME,PUBLICATION_TIME,RELEASE_TIME,RECEPTION_TIME,NONE - - - - - true,false - - - BEFORE,AFTER,ON_OR_BEFORE,ON_OR_AFTER,LESS_THAN,MORE_THAN,EQUAL_OR_LESS,EQUAL_OR_MORE,START,MID,END,APPROX - - - - - - - - - - - - - - - - ADJECTIVE,NOUN,VERB,PREPOSITION,OTHER - FUTURE,INFINITIVE,PAST,PASTPART,PRESENT,PRESPART,NONE - PROGRESSIVE,PERFECTIVE,PERFECTIVE_PROGRESSIVE,NONE - - NEG,POS - - - - - - - - - - - - BEFORE,AFTER,INCLUDES,IS_INCLUDED,DURING,SIMULTANEOUS,IAFTER,IBEFORE,IDENTITY,BEGINS,ENDS,BEGUN_BY,ENDED_BY,DURING_INV - - - - - - - - - - - - MODAL,EVIDENTIAL,NEG_EVIDENTIAL,FACTIVE,COUNTER_FACTIVE,CONDITIONAL - - - - - - - - - - INITIATES,CULMINATES,TERMINATES,CONTINUES,REINITIATES - - - - - - - diff --git a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/linking_configure/timenorm-preannotation-regexes.txt b/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/linking_configure/timenorm-preannotation-regexes.txt deleted file mode 100755 index c602d80..0000000 --- a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/linking_configure/timenorm-preannotation-regexes.txt +++ /dev/null @@ -1,116 +0,0 @@ -(?i)\b\d{1,2}[-/]\d{1,2}[-/]\d{2,4}(?:\s+\d{1,2}:\d{1,2}(?::\d{2})?(?:AM|PM)?)?\b PreAnnotation -(?i)\b\d{1,2}[-/\s]?[A-z]{3}[-/\s]?\d{2,4}(?:\s+\d{1,2}:\d{1,2}(?::\d{2})?(?:AM|PM)?)?\b PreAnnotation -(?i)\b\d{1,2}/\d{1,2}\b PreAnnotation -(?i)\b\d{1,2}/\d{4}\b PreAnnotation -(?i)\b\d{4}[-/]\d{1,2}[-/]\d{1,2}(?:\s+\d{1,2}:\d{1,2}(?::\d{2})?(?:AM|PM)?)?\b PreAnnotation -(?i)\bsec(?:onds?)?\b PreAnnotation -(?i)\bmin(?:utes?)?\b PreAnnotation -(?i)\bh(?:ou)?rs?\b PreAnnotation -(?i)\bdays?\b PreAnnotation -(?i)\bweeks?\b PreAnnotation -(?i)\bmonths?\b PreAnnotation -(?i)\bquarters?\b PreAnnotation -(?i)\by(?:ea)?rs?\b PreAnnotation -(?i)\bdecades?\b PreAnnotation -(?i)\bcentur(?:y|ies)\b PreAnnotation -(?i)\bhourly\b PreAnnotation -(?i)\bdaily\b PreAnnotation -(?i)\bweekly\b PreAnnotation -(?i)\bmonthly\b PreAnnotation -(?i)\bquarterly\b PreAnnotation -(?i)\byearly\b PreAnnotation -(?i)\brarely\b PreAnnotation -(?i)\b\w*annual\w*\b PreAnnotation -(?i)\b\w*spring\w*\b PreAnnotation -(?i)\b\w*summer\w*\b PreAnnotation -(?i)\b\w*fall\w*\b PreAnnotation -(?i)\b\w*autumn\w*\b PreAnnotation -(?i)\b\w*winter\w*\b PreAnnotation -(?i)\b(?:\d+\s*)*Jan(?:uary)?(?:[\s,]*\d+)*\b PreAnnotation -(?i)\b(?:\d+\s*)*Feb(?:ruary)?(?:[\s,]*\d+)*\b PreAnnotation -(?i)\b(?:\d+\s*)*Mar(?:ch)?(?:[\s,]*\d+)*\b PreAnnotation -(?i)\b(?:\d+\s*)*Apr(?:il)?(?:[\s,]*\d+)*\b PreAnnotation -(?i)\b(?:\d+\s*)*May(?:[\s,]*\d+)*\b PreAnnotation -(?i)\b(?:\d+\s*)*Jun(?:e)?(?:[\s,]*\d+)*\b PreAnnotation -(?i)\b(?:\d+\s*)*Jul(?:y)?(?:[\s,]*\d+)*\b PreAnnotation -(?i)\b(?:\d+\s*)*Aug(?:ust)?(?:[\s,]*\d+)*\b PreAnnotation -(?i)\b(?:\d+\s*)*Sep(?:t(?:ember)?)?(?:[\s,]*\d+)*\b PreAnnotation -(?i)\b(?:\d+\s*)*Oct(?:ober)?(?:[\s,]*\d+)*\b PreAnnotation -(?i)\b(?:\d+\s*)*Nov(?:ember)?(?:[\s,]*\d+)*\b PreAnnotation -(?i)\b(?:\d+\s*)*Dec(?:ember)?(?:[\s,]*\d+)*\b PreAnnotation -(?i)\b\w*weekday\w*\b PreAnnotation -(?i)\b\w*weekend\w*\b PreAnnotation -(?i)\bMonday\w*\b PreAnnotation -(?i)\bTuesday\w*\b PreAnnotation -(?i)\bWednesday\w*\b PreAnnotation -(?i)\bThursday\w*\b PreAnnotation -(?i)\bFriday\w*\b PreAnnotation -(?i)\bSaturday\w*\b PreAnnotation -(?i)\bSunday\w*\b PreAnnotation -(?i)\b\w*yesterday\w*\b PreAnnotation -(?i)\b\w*today\w*\b PreAnnotation -(?i)\b\w*tomorrow\w*\b PreAnnotation -(?i)\ba[.]?m[.]?\b PreAnnotation -(?i)\bp[.]?m[.]?\b PreAnnotation -(?i)\b\w*morning\w*\b PreAnnotation -(?i)\b\w*midday\w*\b PreAnnotation -(?i)\bnoon\b PreAnnotation -(?i)\b\w*afternoon\w*\b PreAnnotation -(?i)\b\w*evening\w*\b PreAnnotation -(?i)\beve\b PreAnnotation -(?i)\b\w*night\w*\b PreAnnotation -(?i)\b\w+time\b PreAnnotation -(?i)\binterim\b PreAnnotation -(?i)\bperiods?\b PreAnnotation -(?i)\bbrief\w*\b PreAnnotation -(?i)\b[-\w]+[^a\s]long\b PreAnnotation -(?i)\blong[^e\s][-\w]+\b PreAnnotation -(?i)\b\w+hood\b PreAnnotation -(?i)\blong\s+(?:ago|as)\b PreAnnotation -(?i)\bpast\b PreAnnotation -(?i)\bprevious\w*\b PreAnnotation -(?i)\brecent\w*\b PreAnnotation -(?i)\bcurrent\w*\b PreAnnotation -(?i)\bnow\b PreAnnotation -(?i)\bpresent\w*\b PreAnnotation -(?i)\bsoon\w*\b PreAnnotation -(?i)\beventual\w*\b PreAnnotation -(?i)\bfuture\w*\b PreAnnotation -(?i)\bearl[yi]\w*\b PreAnnotation -(?i)\blate\w*\b PreAnnotation -(?i)\bdate(?!/time)\b PreAnnotation -(?i)\b(? - - - - - True - - - - - - ,Millennia,Centuries,Quarter-Centuries,Decades,Years,Quarter-Years,Months,Weeks,Days,Hours,Minutes,Seconds,Unknown - - - - - - - - - ,Millennium,Century,Quarter-Century,Decade,Year,Quarter-Year,Month,Week,Day,Hour,Minute,Second - - - - - - - - - - - - - - ,Unknown,Spring,Summer,Fall,Winter - - - - - - - ,January,February,March,April,May,June,July,August,September,October,November,December - - - - - - - - - - - - - - - - - - - - - - - - ,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday - - - - - - - - ,Weekdays,Weekend - - - - - - - ,Dawn,Day,Morning,Noon,Afternoon,Evening,Dusk,Night,Midnight,Unknown - - - - - - - ,AM,PM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ,Link,DocTime,DocTime-Era,DocTime-Year,Unknown - - - - - - - - ,Link,DocTime,DocTime-Era,DocTime-Year,Unknown - - - - - - - - Interval-Not-Included,Interval-Included - ,Link,DocTime,DocTime-Era,DocTime-Year,Unknown - - - - - - - - Interval-Not-Included,Interval-Included - ,Link,DocTime,DocTime-Era,DocTime-Year,Unknown - - - - - - - - Interval-Not-Included,Interval-Included - ,Link,DocTime,DocTime-Era,DocTime-Year,Unknown - - - - - - - - Interval-Not-Included,Interval-Included - ,Link,DocTime,DocTime-Era,DocTime-Year,Unknown - - - - - - - - ,Link,DocTime,DocTime-Era,DocTime-Year,Unknown - - Not-Included,Included - ,Link,DocTime,DocTime-Era,DocTime-Year,Unknown - - Not-Included,Included - - - - - ,Link,DocTime,DocTime-Era,DocTime-Year,Unknown - - - - - - - - - ,Link,DocTime,DocTime-Era,DocTime-Year,Unknown - - - - - - - - - - - - - - - - ,Approx,Less-Than,More-Than,Start,Mid,End,Fiscal - - - - - ,Century,Quarter-Century,Decade,Year,Quarter-Year,Month,Week,Day,Hour,Minute,Second,Other - - - - - - - - - - - diff --git a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/model/char-3softmax-extra/lstm_models_2features.hdf5 b/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/model/char-3softmax-extra/lstm_models_2features.hdf5 deleted file mode 100755 index 1375413..0000000 Binary files a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/model/char-3softmax-extra/lstm_models_2features.hdf5 and /dev/null differ diff --git a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/model/char-3softmax-extra/lstm_models_3features.hdf5 b/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/model/char-3softmax-extra/lstm_models_3features.hdf5 deleted file mode 100755 index 9f71d7c..0000000 Binary files a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/model/char-3softmax-extra/lstm_models_3features.hdf5 and /dev/null differ diff --git a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/vocab/char2int.txt b/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/vocab/char2int.txt deleted file mode 100755 index f6134ec..0000000 --- a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/vocab/char2int.txt +++ /dev/null @@ -1 +0,0 @@ -{"": 0, "T": 1, "h": 2, "e": 3, " ": 4, "U": 5, ".": 6, "S": 7, "C": 8, "n": 9, "t": 10, "r": 11, "s": 12, "f": 13, "o": 14, "D": 15, "i": 16, "a": 17, "l": 18, "d": 19, "P": 20, "v": 21, "y": 22, "c": 23, "m": 24, "u": 25, "b": 26, "k": 27, ",": 28, "g": 29, "p": 30, "w": 31, "\n": 32, "W": 33, "M": 34, "z": 35, "-": 36, "2": 37, "0": 38, "9": 39, "N": 40, "\"": 41, ":": 42, "O": 43, "&": 44, "Y": 45, "E": 46, "'": 47, "!": 48, "F": 49, "8": 50, "6": 51, "3": 52, "7": 53, "(": 54, "5": 55, "/": 56, ")": 57, "4": 58, "A": 59, "?": 60, "R": 61, "K": 62, "J": 63, "B": 64, "1": 65, "L": 66, "j": 67, "I": 68, "V": 69, "H": 70, "G": 71, ";": 72, "x": 73, "X": 74, "q": 75, "\u2022": 76, "$": 77, "Q": 78, "Z": 79, "\u00a3": 80, "%": 81, "~": 82, "=": 83, "\u02bc": 84, "\u00b7": 85, "@": 86, "\u00e1": 87, "\u00eb": 88, "\u00b0": 89, "+": 90, "\u00f1": 91, "[": 92, "]": 93, "\u00bb": 94, "#": 95, "_": 96, "\u00e9": 97, "|": 98, "\u00bc": 99, "\u00ed": 100, "\u00fc": 101, "\ufffd": 102, "\u00f6": 103, "\u00bf": 104, "\u20ac": 105, "*": 106, "\u00e7": 107, "\u00e8": 108, ">": 109, "\u00a9": 110, "\u00e0": 111, "\u00bd": 112, "\u00f3": 113, "\u00ae": 114, "\u00c1": 115, "\u00f4": 116, "\u2011": 117, "\u00c2": 118, "\u00e4": 119, "\u00ea": 120, "\u00b4": 121, "<": 122, "\u00c3": 123, "\u201a": 124, "\u00c9": 125, "\u00e2": 126, "\u00cd": 127, "\u00b6": 128, "\u00ab": 129, "\u0095": 130, "\u00e3": 131, "^": 132, "\u00a2": 133, "\u00ef": 134, "\u00ee": 135, "\u201f": 136, "\u00f9": 137, "\u00ba": 138, "\u00fa": 139, "\u2665": 140, "\u00be": 141, "\u25cf": 142, "\u00d7": 143, "\u00fe": 144, "\u0161": 145, "{": 146, "}": 147, "\u00f8": 148, "\ufb01": 149, "\u0175": 150, "\u00dc": 151, "\u00d3": 152, "\uf06e": 153, "\u00c0": 154, "\u00ac": 155, "\u00a4": 156, "\u00f5": 157, "\u0160": 158, "\u00e5": 159, "\u00b2": 160, "\u0410": 161, "\u02da": 162, "\\": 163, "\ue00d": 164, "\u00c5": 165, "\u2020": 166, "\u00b5": 167, "\u2032": 168, "\u017e": 169, "\u0107": 170, "\u0115": 171, "\u20a4": 172, "\u00d6": 173, "\u00c7": 174, "\uffe1": 175, "\u2206": 176, "\u00a1": 177, "\u00a5": 178, "\u00d8": 179, "\u0153": 180, "\u00e6": 181, "\u2463": 182, "\uff08": 183, "\uff09": 184, "\u2010": 185, "\u011b": 186, "\u200e": 187, "\u0105": 188, "\udb86\udfe0": 189, "\u015b": 190, "\u266b": 191, "\u0177": 192, "\uf0a7": 193, "\u00f2": 194, "\ufb00": 195, "\u2500": 196, "\u009c": 197, "\u0080": 198, "\u0083": 199, "\u00d1": 200, "\u02c7": 201, "\u00fb": 202, "\u00b1": 203, "\u0141": 204, "\u1ea3": 205, "\u010d": 206, "\uf095": 207, "\uf020": 208, "\u2212": 209, "\u2122": 210, "\u00ff": 211, "\u25a0": 212, "\u2015": 213, "\u00f0": 214, "\u017d": 215, "\u00b9": 216, "\u00de": 217, "\u017c": 218, "\u00b3": 219, "\u0451": 220, "\u0092": 221, "\u00ce": 222, "\u00a7": 223, "\uf02d": 224, "\u00df": 225, "\u0142": 226} \ No newline at end of file diff --git a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/vocab/dictionary.json b/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/vocab/dictionary.json deleted file mode 100755 index f6134ec..0000000 --- a/timelines/tweaked-timenorm/src/main/resources/org/clulab/timenorm/vocab/dictionary.json +++ /dev/null @@ -1 +0,0 @@ -{"": 0, "T": 1, "h": 2, "e": 3, " ": 4, "U": 5, ".": 6, "S": 7, "C": 8, "n": 9, "t": 10, "r": 11, "s": 12, "f": 13, "o": 14, "D": 15, "i": 16, "a": 17, "l": 18, "d": 19, "P": 20, "v": 21, "y": 22, "c": 23, "m": 24, "u": 25, "b": 26, "k": 27, ",": 28, "g": 29, "p": 30, "w": 31, "\n": 32, "W": 33, "M": 34, "z": 35, "-": 36, "2": 37, "0": 38, "9": 39, "N": 40, "\"": 41, ":": 42, "O": 43, "&": 44, "Y": 45, "E": 46, "'": 47, "!": 48, "F": 49, "8": 50, "6": 51, "3": 52, "7": 53, "(": 54, "5": 55, "/": 56, ")": 57, "4": 58, "A": 59, "?": 60, "R": 61, "K": 62, "J": 63, "B": 64, "1": 65, "L": 66, "j": 67, "I": 68, "V": 69, "H": 70, "G": 71, ";": 72, "x": 73, "X": 74, "q": 75, "\u2022": 76, "$": 77, "Q": 78, "Z": 79, "\u00a3": 80, "%": 81, "~": 82, "=": 83, "\u02bc": 84, "\u00b7": 85, "@": 86, "\u00e1": 87, "\u00eb": 88, "\u00b0": 89, "+": 90, "\u00f1": 91, "[": 92, "]": 93, "\u00bb": 94, "#": 95, "_": 96, "\u00e9": 97, "|": 98, "\u00bc": 99, "\u00ed": 100, "\u00fc": 101, "\ufffd": 102, "\u00f6": 103, "\u00bf": 104, "\u20ac": 105, "*": 106, "\u00e7": 107, "\u00e8": 108, ">": 109, "\u00a9": 110, "\u00e0": 111, "\u00bd": 112, "\u00f3": 113, "\u00ae": 114, "\u00c1": 115, "\u00f4": 116, "\u2011": 117, "\u00c2": 118, "\u00e4": 119, "\u00ea": 120, "\u00b4": 121, "<": 122, "\u00c3": 123, "\u201a": 124, "\u00c9": 125, "\u00e2": 126, "\u00cd": 127, "\u00b6": 128, "\u00ab": 129, "\u0095": 130, "\u00e3": 131, "^": 132, "\u00a2": 133, "\u00ef": 134, "\u00ee": 135, "\u201f": 136, "\u00f9": 137, "\u00ba": 138, "\u00fa": 139, "\u2665": 140, "\u00be": 141, "\u25cf": 142, "\u00d7": 143, "\u00fe": 144, "\u0161": 145, "{": 146, "}": 147, "\u00f8": 148, "\ufb01": 149, "\u0175": 150, "\u00dc": 151, "\u00d3": 152, "\uf06e": 153, "\u00c0": 154, "\u00ac": 155, "\u00a4": 156, "\u00f5": 157, "\u0160": 158, "\u00e5": 159, "\u00b2": 160, "\u0410": 161, "\u02da": 162, "\\": 163, "\ue00d": 164, "\u00c5": 165, "\u2020": 166, "\u00b5": 167, "\u2032": 168, "\u017e": 169, "\u0107": 170, "\u0115": 171, "\u20a4": 172, "\u00d6": 173, "\u00c7": 174, "\uffe1": 175, "\u2206": 176, "\u00a1": 177, "\u00a5": 178, "\u00d8": 179, "\u0153": 180, "\u00e6": 181, "\u2463": 182, "\uff08": 183, "\uff09": 184, "\u2010": 185, "\u011b": 186, "\u200e": 187, "\u0105": 188, "\udb86\udfe0": 189, "\u015b": 190, "\u266b": 191, "\u0177": 192, "\uf0a7": 193, "\u00f2": 194, "\ufb00": 195, "\u2500": 196, "\u009c": 197, "\u0080": 198, "\u0083": 199, "\u00d1": 200, "\u02c7": 201, "\u00fb": 202, "\u00b1": 203, "\u0141": 204, "\u1ea3": 205, "\u010d": 206, "\uf095": 207, "\uf020": 208, "\u2212": 209, "\u2122": 210, "\u00ff": 211, "\u25a0": 212, "\u2015": 213, "\u00f0": 214, "\u017d": 215, "\u00b9": 216, "\u00de": 217, "\u017c": 218, "\u00b3": 219, "\u0451": 220, "\u0092": 221, "\u00ce": 222, "\u00a7": 223, "\uf02d": 224, "\u00df": 225, "\u0142": 226} \ No newline at end of file diff --git a/timelines/tweaked-timenorm/src/main/scala/org/clulab/time/Temporal.scala b/timelines/tweaked-timenorm/src/main/scala/org/clulab/time/Temporal.scala deleted file mode 100755 index 8b4f923..0000000 --- a/timelines/tweaked-timenorm/src/main/scala/org/clulab/time/Temporal.scala +++ /dev/null @@ -1,338 +0,0 @@ -package org.clulab.time - -import java.time.temporal.TemporalField -import java.time.temporal.TemporalUnit -import java.time.temporal.ChronoField._ -import java.time.temporal.ChronoUnit._ -import java.time.temporal.ValueRange -import java.time.temporal.TemporalAccessor -import java.time.temporal.Temporal -import java.time.Duration -import java.time.LocalDate -import java.time.MonthDay -import java.time.temporal.WeekFields -import java.util.Locale - - -abstract class PartialRange(name: String, val field: TemporalField) -extends TemporalUnit { - def first(temporal: TemporalAccessor): Long - def last(temporal: TemporalAccessor): Long - def rangeRefinedBy(temporal: TemporalAccessor): ValueRange - def addToSize(dateTime: Temporal, periodToAdd: Long): Long - def range: ValueRange - def getDuration: Duration - def isDurationEstimated: Boolean - - def isDateBased: Boolean = this.field.isDateBased - def isTimeBased: Boolean = this.field.isTimeBased - override def isSupportedBy(temporal: Temporal): Boolean = this.field.isSupportedBy(temporal) - def addTo[R <: Temporal](temporal: R, amount: Long): R = { - val size = this.addToSize(temporal, amount) - this.field.getBaseUnit().addTo(temporal, amount * size) - } - - def between(temporal1Inclusive: Temporal, temporal2Exclusive: Temporal): Long = ??? - - protected def size(first: Long, last: Long, rangeMinimum: Long, rangeMaximum: Long): Long = { - if (first < last) { - last - first + 1L - } else { - val firstToMax = rangeMaximum - first + 1L - val minToLast = last - rangeMinimum + 1L - firstToMax + minToLast - } - } -} - -abstract class ConstantPartialRange( - name: String, - field: TemporalField, - val first: Long, - val last: Long) extends PartialRange(name, field) { - private val fixedSize = { - this.size(first, last, this.field.range().getMinimum(), this.field.range().getMaximum()) - } - def first(temporal: TemporalAccessor): Long = this.first - def last(temporal: TemporalAccessor): Long = this.last - def rangeRefinedBy(temporal: TemporalAccessor): ValueRange = this.range - def addToSize(dateTime: Temporal, periodToAdd: Long): Long = this.fixedSize - private val rangeMin = this.field.range().getMinimum() - val range: ValueRange = ValueRange.of(this.rangeMin, this.rangeMin + this.fixedSize - 1) - val getDuration: Duration = Duration.of(this.fixedSize, this.field.getBaseUnit()) - val isDurationEstimated: Boolean = this.field.getBaseUnit().isDurationEstimated() -} - -abstract class MonthDayPartialRange( - name: String, - val first: MonthDay, - val last: MonthDay) extends PartialRange(name, DAY_OF_YEAR) { - def first(temporal: TemporalAccessor): Long = { - this.first.atYear(YEAR.checkValidIntValue(YEAR.getFrom(temporal))).get(DAY_OF_YEAR) - } - def last(temporal: TemporalAccessor): Long = { - this.last.atYear(YEAR.checkValidIntValue(YEAR.getFrom(temporal))).get(DAY_OF_YEAR) - } - def rangeRefinedBy(temporal: TemporalAccessor): ValueRange = this.range - def addToSize(dateTime: Temporal, periodToAdd: Long): Long = { - val first = this.first(dateTime) - val last = this.last(dateTime) - // partial range does not stretch across range boundaries - if (first < last) { - val range = this.field.rangeRefinedBy(dateTime) - this.size(first, last, range.getMinimum(), range.getMaximum()) - } - // partial range stretches across two ranges; look at the first partial range - else if (periodToAdd < 0) { - val prevDateTime = this.field.getRangeUnit().addTo(dateTime, -1L) - val prevFirst = this.first(prevDateTime) - val max = this.field.rangeRefinedBy(prevDateTime).getMaximum() - val min = this.field.rangeRefinedBy(dateTime).getMinimum() - this.size(prevFirst, last, min, max) - } - // partial range stretches across two ranges; look at the second partial range - else { - val nextDateTime = this.field.getRangeUnit().addTo(dateTime, 1L) - val nextLast = this.last(nextDateTime) - val max = this.field.rangeRefinedBy(dateTime).getMaximum() - val min = this.field.rangeRefinedBy(nextDateTime).getMinimum() - this.size(first, nextLast, min, max) - } - } - private val sizes = for (year <- Set(1999, 2000)) yield { - this.addToSize(LocalDate.of(year, 1, 1), +1L) - } - val range: ValueRange = ValueRange.of(1, this.sizes.min, this.sizes.max) - val getDuration: Duration = Duration.of(this.sizes.min, DAYS) - val isDurationEstimated: Boolean = true -} - -class BaseUnitOfPartial(name: String, partialRange: PartialRange) -extends TemporalField { - override def getDisplayName(locale: Locale): String = this.name - def getBaseUnit: TemporalUnit = this.partialRange.field.getBaseUnit() - def getRangeUnit: TemporalUnit = this.partialRange - def isDateBased: Boolean = this.getBaseUnit.isDateBased && this.getRangeUnit.isDateBased - def isTimeBased: Boolean = this.getBaseUnit.isTimeBased && this.getRangeUnit.isTimeBased - def range: ValueRange = this.partialRange.range - def getFrom(temporal: TemporalAccessor): Long = { - val baseValue = this.partialRange.field.getFrom(temporal) - val first = this.partialRange.first(temporal) - if (baseValue >= first) { - this.partialRange.rangeRefinedBy(temporal).getMinimum() + baseValue - first - } else { - val maxValue = this.partialRange.field.rangeRefinedBy(temporal).getMaximum() - maxValue - first + 1 + baseValue - } - } - def isSupportedBy(temporal: TemporalAccessor): Boolean = HOUR_OF_DAY.isSupportedBy(temporal) - def rangeRefinedBy(temporal: TemporalAccessor): ValueRange = this.partialRange.rangeRefinedBy(temporal) - def adjustInto[R <: Temporal](temporal: R, newValue: Long): R = { - val range = this.partialRange.field.rangeRefinedBy(temporal) - val rangeMin = range.getMinimum() - val rangeMax = range.getMaximum() - val first = this.partialRange.first(temporal) - val value = first + newValue - rangeMin - val adjustedValue = if (value <= rangeMax) value else value - rangeMax - this.partialRange.field.adjustInto(temporal, adjustedValue) - } -} - -class PartialOfRangeUnit(name: String, partialRange: PartialRange) -extends TemporalField { - def getBaseUnit: TemporalUnit = this.partialRange - def getRangeUnit: TemporalUnit = this.partialRange.field.getRangeUnit() - def isDateBased: Boolean = this.getBaseUnit.isDateBased && this.getRangeUnit.isDateBased - def isTimeBased: Boolean = this.getBaseUnit.isTimeBased && this.getRangeUnit.isTimeBased - def range: ValueRange = ValueRange.of(0, 1) - def getFrom(temporal: TemporalAccessor): Long = { - if (this.contains(temporal)) 1L else 0L - } - def isSupportedBy(temporal: TemporalAccessor): Boolean = HOUR_OF_DAY.isSupportedBy(temporal) - def rangeRefinedBy(temporal: TemporalAccessor): ValueRange = this.range - def adjustInto[R <: Temporal](temporal: R, newValue: Long): R = newValue match { - case 1 => - if (this.contains(temporal)) temporal - else this.partialRange.field.adjustInto(temporal, this.partialRange.first(temporal)) - } - def contains(temporal: TemporalAccessor): Boolean = { - val first = this.partialRange.first(temporal) - val last = this.partialRange.last(temporal) - val value = this.partialRange.field.getFrom(temporal) - if (first < last) first <= value && value <= last - else first <= value || value <= last - } -} - -object MORNINGS extends ConstantPartialRange("Mornings", HOUR_OF_DAY, 0L, 11L) -object MORNING_OF_DAY extends PartialOfRangeUnit("MorningOfDay", MORNINGS) -object HOUR_OF_MORNING extends BaseUnitOfPartial("HourOfMorning", MORNINGS) - -object AFTERNOONS extends ConstantPartialRange("Afternoons", HOUR_OF_DAY, 12L, 17L) -object AFTERNOON_OF_DAY extends PartialOfRangeUnit("AfternoonOfDay", AFTERNOONS) -object HOUR_OF_AFTERNOON extends BaseUnitOfPartial("HourOfAfternoon", AFTERNOONS) - -object EVENINGS extends ConstantPartialRange("Evenings", HOUR_OF_DAY, 17L, 23L) -object EVENING_OF_DAY extends PartialOfRangeUnit("EveningOfDay", EVENINGS) -object HOUR_OF_EVENING extends BaseUnitOfPartial("HourOfEvening", EVENINGS) - -object NIGHTS extends ConstantPartialRange("Nights", HOUR_OF_DAY, 21L, 3L) -object NIGHT_OF_DAY extends PartialOfRangeUnit("NightOfDay", NIGHTS) -object HOUR_OF_NIGHT extends BaseUnitOfPartial("HourOfNight", NIGHTS) - -object WEEKENDS extends ConstantPartialRange("Weekends", DAY_OF_WEEK, 6L, 7L) -object WEEKEND_OF_WEEK extends PartialOfRangeUnit("WeekendOfWeek", WEEKENDS) -object DAY_OF_WEEKEND extends BaseUnitOfPartial("DayOfWeekend", WEEKENDS) - -object SPRINGS extends MonthDayPartialRange( - "Springs", MonthDay.of(3, 20), MonthDay.of(6, 20)) -object SPRING_OF_YEAR extends PartialOfRangeUnit("SpringOfYear", SPRINGS) -object DAY_OF_SPRING extends BaseUnitOfPartial("DayOfSpring", SPRINGS) - -object SUMMERS extends MonthDayPartialRange( - "Summers", MonthDay.of(6, 21), MonthDay.of(9, 21)) -object SUMMER_OF_YEAR extends PartialOfRangeUnit("SummerOfYear", SUMMERS) -object DAY_OF_SUMMER extends BaseUnitOfPartial("DayOfSummer", SUMMERS) - -object FALLS extends MonthDayPartialRange( - "Falls", MonthDay.of(9, 22), MonthDay.of(12, 20)) -object FALL_OF_YEAR extends PartialOfRangeUnit("FallOfYear", FALLS) -object DAY_OF_FALL extends BaseUnitOfPartial("DayOfFall", FALLS) - -object WINTERS extends MonthDayPartialRange( - "Winters", MonthDay.of(12, 21), MonthDay.of(3, 19)) -object WINTER_OF_YEAR extends PartialOfRangeUnit("WinterOfYear", WINTERS) -object DAY_OF_WINTER extends BaseUnitOfPartial("DayOfWinter", WINTERS) - - -object EASTER_DAY_OF_YEAR extends TemporalField { - def getBaseUnit: TemporalUnit = DAYS - def getRangeUnit: TemporalUnit = YEARS - def isDateBased: Boolean = true - def isTimeBased: Boolean = false - def range: ValueRange = ValueRange.of(0, 1) - def getFrom(temporal: TemporalAccessor): Long = { - val (_, _, isEaster) = this.getFromEasterMonthDayIsEaster(temporal) - if (isEaster) 1 else 0 - } - def isSupportedBy(temporal: TemporalAccessor): Boolean = DAY_OF_WEEK.isSupportedBy(temporal) - def rangeRefinedBy(temporal: TemporalAccessor): ValueRange = this.range - def adjustInto[R <: Temporal](temporal: R, newValue: Long): R = { - val (easterMonth, easterDay, isEaster) = this.getFromEasterMonthDayIsEaster(temporal) - newValue match { - case 0 => if (isEaster) DAYS.addTo(temporal, 1) else temporal - case 1 => DAY_OF_MONTH.adjustInto(MONTH_OF_YEAR.adjustInto(temporal, easterMonth), easterDay) - } - } - - private def getFromEasterMonthDayIsEaster(temporal: TemporalAccessor): (Int, Int, Boolean) = { - val year = YEAR.checkValidIntValue(YEAR.getFrom(temporal)) - // from http://aa.usno.navy.mil/faq/docs/easter.php - val century = year / 100 - val n = year - 19 * ( year / 19 ) - val k = ( century - 17 ) / 25 - var i = century - century / 4 - ( century - k ) / 3 + 19 * n + 15 - i = i - 30 * ( i / 30 ) - i = i - ( i / 28 ) * ( 1 - ( i / 28 ) * ( 29 / ( i + 1 ) ) - * ( ( 21 - n ) / 11 ) ) - var j = year + year / 4 + i + 2 - century + century / 4 - j = j - 7 * ( j / 7 ) - val l = i - j - val month = 3 + ( l + 40 ) / 44 - val day = l + 28 - 31 * ( month / 4 ) - (month, day, MONTH_OF_YEAR.getFrom(temporal) == month && DAY_OF_MONTH.getFrom(temporal) == day) - } -} - -object ISO_WEEK { - val OF_YEAR = WeekFields.ISO.weekOfYear() -} - -object DECADE extends TemporalField { - def getBaseUnit: TemporalUnit = DECADES - def getRangeUnit: TemporalUnit = DECADES - def isDateBased: Boolean = true - def isTimeBased: Boolean = false - def range: ValueRange = ValueRange.of(-999, +999) - def getFrom(temporal: TemporalAccessor): Long = YEAR.getFrom(temporal) / 10 - def isSupportedBy(temporal: TemporalAccessor): Boolean = YEAR.isSupportedBy(temporal) - def rangeRefinedBy(temporal: TemporalAccessor): ValueRange = this.range - def adjustInto[R <: Temporal](temporal: R, newValue: Long): R = YEAR.adjustInto(temporal, newValue * 10) -} - -object YEAR_OF_DECADE extends TemporalField { - def getBaseUnit: TemporalUnit = YEARS - def getRangeUnit: TemporalUnit = DECADES - def isDateBased: Boolean = true - def isTimeBased: Boolean = false - def range: ValueRange = ValueRange.of(0, 9) - def getFrom(temporal: TemporalAccessor): Long = YEAR.getFrom(temporal) % 10 - def isSupportedBy(temporal: TemporalAccessor): Boolean = YEAR.isSupportedBy(temporal) - def rangeRefinedBy(temporal: TemporalAccessor): ValueRange = this.range - def adjustInto[R <: Temporal](temporal: R, newValue: Long): R = { - val oldYear = YEAR.getFrom(temporal) - YEAR.adjustInto(temporal, oldYear - oldYear % 10L + newValue) - } -} - -object CENTURY extends TemporalField { - def getBaseUnit: TemporalUnit = CENTURIES - def getRangeUnit: TemporalUnit = CENTURIES - def isDateBased: Boolean = true - def isTimeBased: Boolean = false - def range: ValueRange = ValueRange.of(-99, +99) - def getFrom(temporal: TemporalAccessor): Long = YEAR.getFrom(temporal) / 100 - def isSupportedBy(temporal: TemporalAccessor): Boolean = YEAR.isSupportedBy(temporal) - def rangeRefinedBy(temporal: TemporalAccessor): ValueRange = this.range - def adjustInto[R <: Temporal](temporal: R, newValue: Long): R = YEAR.adjustInto(temporal, newValue * 100) -} - -object DECADE_OF_CENTURY extends TemporalField { - def getBaseUnit: TemporalUnit = DECADES - def getRangeUnit: TemporalUnit = CENTURIES - def isDateBased: Boolean = true - def isTimeBased: Boolean = false - def range: ValueRange = ValueRange.of(0, 9) - def getFrom(temporal: TemporalAccessor): Long = DECADE.getFrom(temporal) % 10L - def isSupportedBy(temporal: TemporalAccessor): Boolean = DECADE.isSupportedBy(temporal) - def rangeRefinedBy(temporal: TemporalAccessor): ValueRange = this.range - def adjustInto[R <: Temporal](temporal: R, newValue: Long): R = { - val oldDecade = DECADE.getFrom(temporal) - DECADE.adjustInto(temporal, oldDecade - oldDecade % 10L + newValue) - } -} - -object QUARTER_CENTURIES extends TemporalUnit { - override def isDateBased: Boolean = true - override def isTimeBased: Boolean = false - override def getDuration: Duration = YEARS.getDuration.multipliedBy(25L) - override def isDurationEstimated: Boolean = YEARS.isDurationEstimated - override def addTo[R <: Temporal](temporal: R, amount: Long): R = YEARS.addTo(temporal, amount * 25) - override def between(temporal1Inclusive: Temporal, temporal2Exclusive: Temporal): Long = - YEARS.between(temporal1Inclusive, temporal2Exclusive) / 25 -} - -object YEAR_OF_CENTURY extends TemporalField { - def getBaseUnit: TemporalUnit = YEARS - def getRangeUnit: TemporalUnit = CENTURIES - def isDateBased: Boolean = true - def isTimeBased: Boolean = false - def range: ValueRange = ValueRange.of(0, 99) - def getFrom(temporal: TemporalAccessor): Long = YEAR.getFrom(temporal) % 100 - def isSupportedBy(temporal: TemporalAccessor): Boolean = YEAR.isSupportedBy(temporal) - def rangeRefinedBy(temporal: TemporalAccessor): ValueRange = this.range - def adjustInto[R <: Temporal](temporal: R, newValue: Long): R = { - val oldYear = YEAR.getFrom(temporal) - YEAR.adjustInto(temporal, oldYear - oldYear % 100L + newValue) - } -} - -object UNSPECIFIED extends TemporalUnit { - def isDateBased: Boolean = true - def isTimeBased: Boolean = false - def getDuration: Duration = FOREVER.getDuration() - def isDurationEstimated: Boolean = true - override def isSupportedBy(temporal: Temporal): Boolean = false - def addTo[R <: Temporal](temporal: R, amount: Long): R = ??? - def between(temporal1Inclusive: Temporal, temporal2Exclusive: Temporal): Long = ??? -} diff --git a/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/Evaluator.scala b/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/Evaluator.scala deleted file mode 100755 index 3dbac44..0000000 --- a/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/Evaluator.scala +++ /dev/null @@ -1,157 +0,0 @@ -package org.clulab.timenorm.scfg - -import scala.io.{Codec, Source} -import scala.util.{Failure, Success} -import java.io.File -import java.io.PrintWriter - -object Evaluator { - /** - This program normalizes timexes and compares the results to their gold - standard normalizations - */ - - def main(lang: String, inFile: String, outFile: String): Unit = { - /** - Enter the language ("es"/"en") and the input and output paths - - Both input and output files are .tsv files with timexes in the 1st column, - gold normalization value in the 2nd column and, in the output file, system - normalization value in the 3rd column. Timexes from different documents must - be separated by newlines, being DCTs the first timexes from each document - */ - - // Obtain the data of timexes and gold values from the input file - val (timexList, goldList) = getContent(inFile) - // Obtain the normalizations of the timexes. - val normList = getNormalizations(lang, timexList) - // Compare gold and system normalizations, write the results and get the - //sums of timexes and correct normalizations - val (sumGold, sumNorm) = compareAndWrite(outFile, timexList, goldList, normList) - - // Compute number of errors and accuracy - val sumErrors = sumGold - sumNorm - val accuracy = sumNorm.toFloat * 100 / sumGold - - // Print the final statistics - println(f"""\n - |Number of timexes (also DCTs): $sumGold%6d - |Correct normalizations: $sumNorm%6d - |Incorrect normalizations: $sumErrors%6d - |Accuracy: $accuracy%6.2f\n""".stripMargin) - } - - def getContent(inFile: String): (List[String], List[String]) = { - /** Obtains the content from the input file as timex and value lists */ - - val source = Source.fromFile(inFile)(Codec.UTF8) - val lines = try { - source.getLines.toList - } - finally { - source.close() - } - val content = lines.map { line => - val split = line.split('\t') - (split.lift(0).getOrElse(""), split.lift(2).getOrElse("")) - }.unzip - println(content) - content - } - - def getNormalizations(lang: String, timexList: List[String]): List[String] = { - /** Processes the data, sends timexes and DCTs to the normalizer and returns - the list with all the normalizations */ - - // Select the parser for the desired grammar depending on the language - val parser = lang match { - case "es" => TemporalExpressionParser.es() - case "en" => TemporalExpressionParser.en() - case "it" => TemporalExpressionParser.it() - } - - var dctTimeSpanOpt: Option[TimeSpan] = None - val normList = timexList.map { timex => - // If this is a timex (is not a doc separator): - if (timex.nonEmpty) { - println(timex) - // If this is the first timex in a doc, consider it a DCT - if (dctTimeSpanOpt.isEmpty) - dctTimeSpanOpt = Some(mkTimeSpan(timex)) - // Normalize the timex and append the normalization - normalize(parser, timex, dctTimeSpanOpt.get) - } - // If this is a doc separator, empty the DCT timex and append "" - else { - dctTimeSpanOpt = None - "" - } - } - - normList - } - - def mkTimeSpan(timex: String): TimeSpan = { - val timeSpan = timex.replace('T', '-').replace(':', '-').split('-').map(_.toInt) match { - case Array(year, month, day) => TimeSpan.of(year, month, day) - case Array(year, month, day, hour, minute, second) => TimeSpan.of(year, month, day, hour, minute, second) - case Array(year, month, day, hour, minute) => TimeSpan.of(year, month, day, hour, minute, 0) - } - - timeSpan - } - - def normalize(parser: TemporalExpressionParser, timex: String, dctTimeSpan: TimeSpan): String = { - /** Normalizes a timex according to the parser and the DCT TimeSpan. - DCTs are normalized with respect to themselves */ - - // Parse the timex with respect to its anchor - parser.parse(timex, dctTimeSpan) match { - // If the parser fails, return an empty string as normalization - case Failure(_) => "-" - // If the parser successes, return the normalization of the timex - case Success(temporal) => temporal.timeMLValue - } - } - - def compareAndWrite(outFile: String, timexList: List[String], - goldList: List[String], normList: List[String]): (Int, Int) = { - // Create the output writer - val printWriter = new PrintWriter(new File(outFile), Codec.UTF8.toString) - try { - compareAndWrite(printWriter, timexList, goldList, normList) - } - finally { - printWriter.close() - } - } - - def compareAndWrite(printWriter: PrintWriter, timexList: List[String], - goldList: List[String], normList: List[String]): (Int, Int) = { - /** Writes the results to the printWriter, in "{timex}\t{gold}\t{norm}" - format, and counts the number of timexes and correct normalizations */ - - def next(current: Int, condition: Boolean): Int = if (condition) current + 1 else current - - // Iterate over timex list and get each timex, gold and norm set - val goldAndNormCounters = (timexList, goldList, normList).zipped.foldLeft(0, 0) { case ((goldCounter, normCounter), (timex, gold, norm)) => - println(s"$timex\t$gold\t$norm") - val (isGold, isNorm) = if (timex.nonEmpty) { - // If this is a timex, write the data - printWriter.println(s"$timex\t$gold\t$norm") - // If this is a timex, sum a gold value - // If timex exists in corpus and normalization is equal to gold, - // sum a correct norm value - (true, gold != "-" && norm == gold) - } - else { - // If this is a doc separator, write a newline - printWriter.println() - (false, false) - } - - (next(goldCounter, isGold), next(normCounter, isNorm)) - } - goldAndNormCounters - } -} diff --git a/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/SynchronousGrammar.scala b/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/SynchronousGrammar.scala deleted file mode 100755 index 0e84992..0000000 --- a/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/SynchronousGrammar.scala +++ /dev/null @@ -1,252 +0,0 @@ -package org.clulab.timenorm.scfg - -import scala.collection.immutable.{IndexedSeq, Seq} - -/** - * A set of root symbols and synchronous rules that define a synchronous grammar. - * - * Non-terminal symbols should be alphanumeric characters enclosed in square brackets, for example, - * `[Period]`, `[TimeSpan]` or `[Int]`. - * - * A single colon can be used to "subtype" a non-terminal, e.g. `[Int:4Digit]` or `[Unit:Singular]`. - * In such cases, the symbol without the subtype information is called the "basic symbol", e.g. - * `[Int]` and `[Unit]` are the basic symbols for the preceding two examples. - * - * A symbol of the form `[Int:X-Y]`, where X and Y are integers, is treated as a numeric range - * specification (inclusive of both endpoints). [[SynchronousParser]] has special handling of - * such ranges. - * - * A non-terminal whose basic symbol is `[Nil]` is called a "nil symbol". [[SynchronousParser]] has - * special handling of such nil symbols. - * - * @constructor Create a new grammar from a set of root symbols and a set of synchronous rules. - * @param rootSymbols The symbols that are allowed to be the root of a parse. - * @param rules The synchronous rules. - */ -class SynchronousGrammar(val rootSymbols: Set[String], val rules: Seq[SynchronousGrammar.Rule]) { - - private val rulePrefixMap = PrefixMultiMap.empty[String, SynchronousGrammar.Rule] - for (rule <- rules) { - this.rulePrefixMap += (rule.sourceSeq, rule) - } - - private val numberRegex = "^\\[Int:(\\d*)-(\\d*)\\]$".r - private val numberRanges: Set[Range.Inclusive] = ( - for { - rule <- rules - numberRegex(begin, end) <- rule.symbol +: rule.sourceSeq - } yield { - begin.toInt to end.toInt - }).toSet - - /** - * Gets all non-terminal symbols whose range allows a particular number. - * - * @param number The number whose possible non-terminal symbols are to be found. - * @return Each non-terminal symbol whose range allows the number. - */ - def sourceSymbolsForNumber(number: Int): Set[String] = { - val symbolsWithRanges = - for (range <- this.numberRanges; if range.contains(number)) - yield "[Int:%d-%d]".format(range.start, range.end) - symbolsWithRanges + "[Int]" - } - - /** - * Gets all rules whose source side starts with a token sequence. - * - * @param tokens The sequence of source tokens. - * @return All rules whose source side starts with the given tokens. - */ - def sourceSeqStartsWith(tokens: Seq[String]): Set[SynchronousGrammar.Rule] = { - this.rulePrefixMap.getAllWithPrefix(tokens) - } - - /** - * Gets all rules whose source side starts with a token. - * - * @param token The source token. - * @return All rules whose source side starts with the given token. - */ - def sourceSeqStartsWith(token: String): Set[SynchronousGrammar.Rule] = { - this.rulePrefixMap.getAllWithPrefix(Seq(token)) - } - - /** - * Gets all symbols used in the grammar. - * - * This includes both terminal and non-terminal symbols - * - * @return All symbols in the grammar. - */ - def sourceSymbols(): Set[String] = { - this.rules.flatMap(_.sourceSeq).toSet - } -} - -object SynchronousGrammar { - - /** - * Determines whether a token is a terminal or non-terminal. - * - * Currently, tokens must start with "[" and end with "]" to be a non-terminal. - * - * @param token A token from a grammar. - * @return True if the token is a terminal, false otherwise. - */ - def isTerminal(token: String): Boolean = !token.matches("^\\[.*\\]$") - - /** - * Strips any sub-type information from a non-terminal symbol. - * - * For example, `[Int:4Digit]` would be converted to `[Int]` - * - * @param token A non-terminal token from the grammar. - * @return A non-terminal token without the sub-type information. - */ - def basicSymbol(token: String): String = token.replaceAll(":[^\\]]*", "") - - /** - * Determines whether a token is a number or not. - * - * Currently, only tokens that are all digits are considered to be numbers. - * - * @param token A token from a grammar. - * @return True if the token is a number, false otherwise. - */ - def isNumber(token: String): Boolean = token.matches("^\\d+$") - - /** - * Determines whether a token is a nil non-terminal symbol or not. - * - * Currently, only non-terminals whose basic symbol is "[Nil]" are considered to be nils. - * - * @param token A token from a grammar. - * @return True if the token is a nil non-terminal, false otherwise. - */ - def isNil(token: String): Boolean = this.basicSymbol(token) == "[Nil]" - - /** - * Parses a [[SynchronousGrammar]] from a string representation. - * - * The first line defines the one or more root symbols and looks like: - *
-   * ROOTS [Period] [TimeSpan] ...
-   * 
- * The remaining lines follow the format of Joshua/Heiro - * (http://joshua-decoder.org/4.0/file-formats.html) and look like: - *
-   * [Period] ||| [Period,1] and [Period,2] ||| Sum [Period,1] [Period,2] ||| 1.0
-   * ...
-   * 
- * - * @param text The formatted grammar string. - * @return A new [[SynchronousGrammar]]. - */ - def fromString(text: String): SynchronousGrammar = { - val stripLabel: (String => String) = _.replaceAll("\\[(.*),.*\\]", "[$1]") - // workaround instead of just `text.lines` because jdk11 also defines `String.lines` - val lines = text.linesWithSeparators.map(_.stripLineEnd) - val firstLine = lines.next - if (!firstLine.startsWith("ROOTS")) { - throw new IllegalArgumentException("First line must define root symbols, e.g. ROOTS [XXX] [YYY]") - } - val rootSymbols = firstLine.split("\\s+").tail.toSet - val nonCommentLines = lines.filterNot(_.startsWith("//")) - val rules = for (line <- nonCommentLines) yield line.trim.split("\\s*[|][|][|]\\s*") match { - case Array(symbol, sourceSeqString, targetSeqString, scoreString) => { - val sourceSeqItems = sourceSeqString.split("\\s+").toIndexedSeq - val targetSeqItems = targetSeqString.split("\\s+").toIndexedSeq - val sourceNonTerminals = sourceSeqItems.filterNot(this.isTerminal) - val targetNonTerminals = targetSeqItems.filterNot(this.isTerminal) - val alignment = for ((token, targetIndex) <- targetNonTerminals.zipWithIndex) yield { - if (sourceNonTerminals.count(_ == token) != 1) { - val message = "Expected exactly 1 non-terminal matching \"%s\" in \"%s\"" - throw new IllegalArgumentException(message.format(token, sourceSeqString)) - } - targetIndex -> sourceNonTerminals.indexOf(token) - } - Some(Rule(symbol, sourceSeqItems.map(stripLabel), targetSeqItems.map(stripLabel), alignment.toMap)) - } - case Array("") => None - case _ => throw new IllegalArgumentException("\"" + line + "\"") - } - new SynchronousGrammar(rootSymbols, rules.flatten.toList) - } - - /** - * A synchronous grammar rule. - * - * @constructor Creates a synchronous grammar rule. - * @param symbol A non-terminal symbol - * @param sourceSeq The sequence of source tokens - * @param targetSeq The sequence of target tokens - * @param nonTerminalAlignment A mapping from source non-terminal indexes to the corresponding - * target non-terminal indexes. For example, Map(1->2, 2->1) would indicate - * that the first source non-terminal is the second target non-terminal and vice versa. - */ - case class Rule(symbol: String, sourceSeq: IndexedSeq[String], targetSeq: IndexedSeq[String], nonTerminalAlignment: Map[Int, Int]) { - - /** - * Strips any sub-type information from this rule's symbol. - * - * See [[SynchronousGrammar.basicSymbol]]. - */ - val basicSymbol = SynchronousGrammar.basicSymbol(this.symbol) - - /** - * Determines whether this rule's symbol is a nil non-terminal symbol or not. - * - * See [[SynchronousGrammar.isNil]]. - */ - val isNil = SynchronousGrammar.isNil(this.symbol) - } -} - -private[timenorm] class PrefixMultiMap[K, V] { - - var suffixes = Map.empty[K, PrefixMultiMap[K, V]] - var values = Set.empty[V] - - def +=(key: Seq[K], value: V): Unit = { - if (key.isEmpty) { - this.values += value - } else { - val head = key.head - if (!this.suffixes.contains(head)) { - this.suffixes += head -> new PrefixMultiMap[K, V] - } - this.suffixes(head) += (key.tail, value) - } - } - - def get(key: Seq[K]): Set[V] = { - this.getMap(key) match { - case None => Set.empty - case Some(map) => map.values - } - } - - def getAll: Set[V] = { - this.values ++ this.suffixes.values.flatMap(_.getAll) - } - - def getAllWithPrefix(key: Seq[K]): Set[V] = { - this.getMap(key) match { - case None => Set.empty - case Some(map) => map.getAll - } - } - - private def getMap(key: Seq[K]): Option[PrefixMultiMap[K, V]] = { - if (key.isEmpty) { - Some(this) - } else { - this.suffixes.get(key.head).flatMap(_.getMap(key.tail)) - } - } -} - -private[timenorm] object PrefixMultiMap { - def empty[K, V] = new PrefixMultiMap[K, V] -} diff --git a/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/SynchronousParser.scala b/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/SynchronousParser.scala deleted file mode 100755 index 7ea091b..0000000 --- a/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/SynchronousParser.scala +++ /dev/null @@ -1,262 +0,0 @@ -package org.clulab.timenorm.scfg - -import scala.collection.immutable.IndexedSeq -import scala.collection.mutable -import scala.collection.mutable.ListBuffer -import scala.util.{Try, control} - -/** - * A parser for synchronous grammars. - * - * @constructor Create a new parser from a synchronous grammar. - * @param grammar A synchronous grammar. - */ -class SynchronousParser(grammar: SynchronousGrammar) { - - import SynchronousParser._ - - /** - * Parse the source tokens into a tree non-terminals and target tokens. - * - * @param sourceTokens The source tokens to be parsed. - * @return The parsed tree of non-terminals and target tokens. - */ - def parseAll(sourceTokens: Array[String]): Array[Tree.NonTerminal] = { - this.parseAll(sourceTokens.toIndexedSeq).toArray - } - - /** - * Parse the source tokens into a tree non-terminals and target tokens. - * - * @param sourceTokens The source tokens to be parsed. - * @return The parsed tree of non-terminals and target tokens. - */ - def parseAll(sourceTokens: IndexedSeq[String]): IndexedSeq[Tree.NonTerminal] = { - if (sourceTokens.isEmpty) { - throw new UnsupportedOperationException("Cannot parse empty token sequence") - } - val chart = this.parseChart(sourceTokens) - val completes = chart(sourceTokens.size)(0).completes - val roots = completes.filter(parse => this.grammar.rootSymbols.contains(parse.rule.symbol)) - val trees = roots.map(_.toTargetTree).toIndexedSeq - if (trees.isEmpty) { - val nTokens = sourceTokens.size - val completes = - for { - size <- 1 to nTokens - start <- 0 until (nTokens - size + 1) - complete <- chart(size)(start).completes - } yield { - "%s(%s)".format(complete.rule.symbol, sourceTokens.slice(start, start + size).mkString(",")) - } - val message = "Could not parse %s. Partial parses:\n%s" - throw new UnsupportedOperationException(message.format(sourceTokens, completes.mkString("\n"))) - } - trees - } - - /** - * Attempt to parse the source tokens into a tree of non-terminals and target tokens. - * - * @param sourceTokens The source tokens to be parsed. - * @return Success(trees) if the source tokens could be parsed, Failure otherwise. - */ - def tryParseAll(sourceTokens: IndexedSeq[String]): Try[IndexedSeq[Tree.NonTerminal]] = { - control.Exception.catching(classOf[UnsupportedOperationException]).withTry(parseAll(sourceTokens)) - } - - private def parseChart(sourceTokens: IndexedSeq[String]): Array[Array[ChartEntry]] = { - val nTokens = sourceTokens.size - val chart = Array.tabulate(nTokens + 1, nTokens) { - (size, start) => if (size == 0 || start + size > nTokens) null else ChartEntry() - } - - // special handling of [Number]: pass through tokens that are numbers - for (start <- 0 until nTokens) { - val token = sourceTokens(start) - if (SynchronousGrammar.isNumber(token)) { - for (symbol <- grammar.sourceSymbolsForNumber(token.toInt)) { - val rule = SynchronousGrammar.Rule(symbol, IndexedSeq(token), IndexedSeq(token), Map.empty) - chart(1)(start).completes += Parse(rule, IndexedSeq.empty) - } - } - } - - // fill rules that start with terminals - for (start <- 0 until nTokens) { - for (rule <- grammar.sourceSeqStartsWith(sourceTokens(start))) { - val initialTerminals = rule.sourceSeq.takeWhile(SynchronousGrammar.isTerminal) - val size = initialTerminals.size - if (sourceTokens.slice(start, start + size) == initialTerminals) { - val entry = chart(size)(start) - if (rule.sourceSeq.size == size) { - entry.completes += Parse(rule, IndexedSeq.empty) - } else { - entry.partials += PartialParse(rule, size, IndexedSeq.empty) - } - } - } - } - - // fill in the chart from the smallest sizes to the biggest sizes - for (size <- 1 to nTokens; start <- 0 to (nTokens - size)) { - val entry = chart(size)(start) - - // look for ways to create entries of size `size` from the current partial parses - for (size1 <- 1 until size) { - val start2 = start + size1 - val size2 = size - size1 - for (partial <- chart(size1)(start).partials) { - - // partials that can be advanced to `size` using terminals - val newSourceSeqIndex = partial.sourceSeqIndex + size2 - val symbolSeq = partial.rule.sourceSeq.slice(partial.sourceSeqIndex, newSourceSeqIndex) - val tokenSeq = sourceTokens.slice(start2, start2 + size2) - if (symbolSeq.forall(SynchronousGrammar.isTerminal) && symbolSeq == tokenSeq) { - if (partial.rule.sourceSeq.size == newSourceSeqIndex) { - entry.completes += Parse(partial.rule, partial.nonTerminalRules) - } else { - entry.partials += PartialParse(partial.rule, newSourceSeqIndex, partial.nonTerminalRules) - } - } - - // partials that can be advanced to `size` using completed non-terminals - for (complete <- chart(size2)(start2).completes) { - if (partial.rule.sourceSeq(partial.sourceSeqIndex) == complete.rule.symbol) { - val sourceSeqIndex = partial.sourceSeqIndex + 1 - val nonTerminalRules = partial.nonTerminalRules :+ complete - if (partial.rule.sourceSeq.size == sourceSeqIndex) { - entry.completes += Parse(partial.rule, nonTerminalRules) - } else { - entry.partials += PartialParse(partial.rule, sourceSeqIndex, nonTerminalRules) - } - } - } - } - - // expand complete parses if there are Nil parses beside them - for (complete1 <- chart(size1)(start).completes) { - for (complete2 <- chart(size2)(start2).completes) { - if (!complete1.rule.isNil && complete2.rule.isNil) { - entry.completes += complete1 - } else if (complete1.rule.isNil && !complete2.rule.isNil) { - entry.completes += complete2 - } - } - } - } - - // create parses for rules that start with any of the currently complete parses - // NOTE: we have to use a queue here because the loop itself may add more completed - // rules that we then also need to process - val queue = mutable.Queue.empty ++ entry.completes - while (queue.nonEmpty) { - val complete = queue.dequeue - for (rule <- grammar.sourceSeqStartsWith(complete.rule.symbol)) { - if (rule.sourceSeq.tail.isEmpty) { - val complete2 = Parse(rule, IndexedSeq(complete)) - queue.enqueue(complete2) - entry.completes += complete2 - } else { - entry.partials += PartialParse(rule, 1, IndexedSeq(complete)) - } - } - } - } - chart - } -} - -object SynchronousParser { - - /** - * A tree of non-terminals and tokens. - * - * Used primarily by [[SynchronousParser]] to represent the tree of target non-terminals - * and terminals that correspond to an input sequence of source terminals. - */ - sealed trait Tree - - /** - * Contains the different types of [[Tree]]s. - */ - object Tree { - - /** - * A tree representing a terminal token. - * - * Used primarily by [[SynchronousParser]] to represent target terminals. - * - * @constructor Creates a terminal tree from a token. - * @param token A token. - */ - case class Terminal(token: String) extends Tree - - /** - * A tree representing a non-terminal. - * - * Used primarily by [[SynchronousParser]] to represent target non-terminals. - * - * @constructor Creates a non-terminal tree from a rule and a list of children. - * @param rule A synchronous grammar rule. - * @param children The trees that are children of this non-terminal. - */ - case class NonTerminal(rule: SynchronousGrammar.Rule, children: List[Tree]) extends Tree - } - - private[SynchronousParser] case class Parse( - rule: SynchronousGrammar.Rule, - nonTerminalRules: IndexedSeq[Parse]) { - - def toTargetTree: Tree.NonTerminal = { - var nonTerminalIndex = -1 - val children = for ((token, i) <- this.rule.targetSeq.zipWithIndex) yield { - if (SynchronousGrammar.isTerminal(token)) { - Tree.Terminal(token) - } else { - nonTerminalIndex += 1 - val nonTerminalRulesIndex = this.rule.nonTerminalAlignment(nonTerminalIndex) - this.nonTerminalRules(nonTerminalRulesIndex).toTargetTree - } - } - val subtrees = this.insertSubtreesFromParentheses(children.iterator) - Tree.NonTerminal(rule, subtrees) - } - - private def insertSubtreesFromParentheses(trees: Iterator[Tree]): List[Tree] = { - if (trees.isEmpty) { - Nil - } else { - val tree = trees.next match { - case Tree.Terminal("(") => this.parseSubtreeFollowingOpenParentheses(trees) - case tree => tree - } - tree :: this.insertSubtreesFromParentheses(trees) - } - } - - private def parseSubtreeFollowingOpenParentheses(trees: Iterator[Tree]): Tree = { - val Tree.Terminal(symbol) = trees.next - val children = ListBuffer.empty[Tree] - var getNext = true - while (getNext) { - trees.next match { - case Tree.Terminal(")") => getNext = false - case Tree.Terminal("(") => children += this.parseSubtreeFollowingOpenParentheses(trees) - case tree => children += tree - } - } - val rule = SynchronousGrammar.Rule("[" + symbol + "]", IndexedSeq.empty, IndexedSeq.empty, Map.empty) - Tree.NonTerminal(rule, children.toList) - } - } - - private[SynchronousParser] case class PartialParse( - rule: SynchronousGrammar.Rule, - sourceSeqIndex: Int, - nonTerminalRules: IndexedSeq[Parse]) - - private[SynchronousParser] case class ChartEntry( - completes: mutable.Set[Parse] = mutable.Set.empty, - partials: mutable.Set[PartialParse] = mutable.Set.empty) -} diff --git a/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/Temporal.scala b/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/Temporal.scala deleted file mode 100755 index 5035aaf..0000000 --- a/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/Temporal.scala +++ /dev/null @@ -1,719 +0,0 @@ -package org.clulab.timenorm.scfg - -import java.time.temporal.ChronoField._ -import java.time.temporal.ChronoUnit._ -import java.time.temporal.IsoFields._ -import java.time.temporal.{TemporalField, TemporalUnit} -import java.time.{LocalDateTime, ZoneId, ZonedDateTime} - -import org.clulab.time._ - -import scala.collection.immutable.ListMap - -/** - * A temporal object, such as a time span or a period. - */ -sealed trait Temporal { - - /** - * The temporal object, formatted as a - * [[http://timeml.org/site/publications/timeMLdocs/timeml_1.2.1.html#timex3 TIMEX3 value attribute]]. - */ - val timeMLValue: String -} - -/** - * An unanchored period of time such as "three weeks" or "a year". - * - * @constructor Creates a period from units and their amounts. - * @param unitAmounts A mapping of temporal units to their associated amounts, e.g. `Map(WEEKS->3)`. - * @param modifier A modifier (for periods that are not exact). - */ -case class Period( - unitAmounts: Map[TemporalUnit, Int], - modifier: Modifier = Modifier.Exact) extends Temporal { - - private val simplifyUnitMap = ListMap[TemporalUnit, Seq[(TemporalUnit, Int)]]( - DECADES -> Seq((YEARS, 10)), - CENTURIES -> Seq((DECADES, 10), (YEARS, 100))) - - private val unitChars = ListMap[TemporalUnit, String]( - UNSPECIFIED -> "X", - CENTURIES -> "CE", - DECADES -> "DE", - YEARS -> "Y", - QUARTER_YEARS -> "Q", - SPRINGS -> "SP", - SUMMERS -> "SU", - FALLS -> "FA", - WINTERS -> "WI", - MONTHS -> "M", - WEEKS -> "W", - WEEKENDS -> "WE", - MORNINGS -> "MO", - AFTERNOONS -> "AF", - EVENINGS -> "EV", - NIGHTS -> "NI", - DAYS -> "D", - HOURS -> "H", - MINUTES -> "M", - SECONDS -> "S") - - val timeMLValue: String = { - val simpleUnitAmounts = this.simplifyUnitMap.foldLeft(this.unitAmounts) { - case (counts, (unit, unitMultipliers)) => counts.get(unit) match { - case None => counts - case Some(Int.MaxValue) => counts - case Some(value) => unitMultipliers.find(um => counts.contains(um._1)) match { - case None => counts - case Some((newUnit, multiplier)) => - counts - unit + (newUnit -> (counts(newUnit) + value * multiplier)) - } - } - } - val units = simpleUnitAmounts.keySet.toSeq.sortBy(_.getDuration).reverse - val parts = for (unit <- units; if simpleUnitAmounts(unit) != 0) yield { - val amount = simpleUnitAmounts(unit) match { - case Int.MaxValue => "X" - case i => i.toString - } - val suffix = this.unitChars.get(unit) match { - case None => throw new UnsupportedOperationException("Don't know how to format " + unit) - case Some(string) => string - } - (unit, amount + suffix) - } - val (dateParts, timeParts) = parts.partition(_._1.getDuration.compareTo(HOURS.getDuration) > 0) - val timeString = if (timeParts.isEmpty) "" else "T" + timeParts.map(_._2).mkString - "P" + dateParts.map(_._2).mkString + timeString - } - - /** - * Adds this period to another period. - */ - def +(that: Period): Period = Period( - this.mapOverUnion(that, _ + _).toMap, - this.modifier & that.modifier) - - /** - * Subtracts a period from this period. - */ - def -(that: Period): Period = Period( - this.mapOverUnion(that, _ - _).toMap, - this.modifier & that.modifier) - - /** - * Determines whether this period is longer than the given unit. - */ - def >(unit: TemporalUnit): Boolean = { - if (this.unitAmounts.isEmpty) { - false - } else { - val maxUnit = this.unitAmounts.keySet.maxBy(_.getDuration) - maxUnit.getDuration.compareTo(unit.getDuration) > 0 || - (maxUnit == unit && this.unitAmounts(maxUnit) > 1) - } - } - - /** - * Moves a time later by the amount of this period. - */ - def addTo(time: ZonedDateTime): ZonedDateTime = this.unitAmounts.foldLeft(time) { - case (time, (unit, value)) => time.plus(value, unit) - } - - /** - * Moves a time earlier by the amount of this period. - */ - def subtractFrom(time: ZonedDateTime): ZonedDateTime = this.unitAmounts.foldLeft(time) { - case (time, (unit, value)) => time.minus(value, unit) - } - - private def mapOverUnion(that: Period, op: (Int, Int) => Int): Iterable[(TemporalUnit, Int)] = { - for (unit <- this.unitAmounts.keySet ++ that.unitAmounts.keySet) - yield (unit, op(this.unitAmounts.getOrElse(unit, 0), that.unitAmounts.getOrElse(unit, 0))) - } -} - -/** - * Factory for creating [[Period]] instances. - */ -object Period { - - /** - * The period containing nothing. - */ - final val empty = Period(Map.empty) - - /** - * The period representing an unspecified amount of time. - */ - final val unspecified = Period(Map(UNSPECIFIED -> Int.MaxValue)) - - /** - * Creates a period from a unit and a fractional amount. - * - * Only certain types of units that can naturally be divided into smaller units (e.g. 1 year is - * 12 months) are supported. - * - * @param numerator The numerator of the fractional amount. - * @param denominator The denominator of the fractional amount. - * @param unit The temporal unit for the period. - * @param modifier The modifier for the period. - * @return A period representing the fractional amount - */ - def fromFractional(numerator: Int, denominator: Int, unit: TemporalUnit, modifier: Modifier = Modifier.Exact): Period = { - var map = Map(unit -> (numerator / denominator)) - var currRemainder = numerator % denominator - var currUnit = unit - while (currRemainder != 0) { - this.smallerUnit.get(currUnit) match { - case None => throw new UnsupportedOperationException("Don't know how to split " + currUnit) - case Some((multiplier, nextUnit)) => - val numerator = currRemainder * multiplier - map += nextUnit -> (numerator / denominator) - currUnit = nextUnit - currRemainder = numerator % denominator - } - } - Period(map, modifier) - } - - private final val smallerUnit = Map[TemporalUnit, (Int, TemporalUnit)]( - YEARS -> (12, MONTHS), - MONTHS -> (30, DAYS), - WEEKS -> (7, DAYS), - DAYS -> (24, HOURS), - HOURS -> (60, MINUTES), - MINUTES -> (60, SECONDS)) -} - -/** - * An unanchored set of periods, such as "daily" or "two days a week". - * - * @constructor Creates a period set from a period and various attributes. - * @param period The base period of the period set. - * @param modifier A modifier if the period set is not exact. - * @param quantifier A quantifier (to capture expressions like the "every" in "every day"). - * @param frequency A frequency (to capture expressions like "two days" in "two days a week"). - */ -case class PeriodSet( - period: Period, - modifier: Modifier = Modifier.Exact, - quantifier: PeriodSet.Quantifier = PeriodSet.Quantifier.None, - frequency: PeriodSet.Frequency = PeriodSet.Frequency(1)) extends Temporal { - val timeMLValue = this.period.timeMLValue -} - -/** - * Provider of different [[PeriodSet]] attributes. - */ -object PeriodSet { - - /** - * A frequency like "five times", or "two days" in "two days a week". - * - * @constructor Creates a frequency from a number and an optional unit. - * @param times The numeric frequency. - * @param unit An optional unit for the frequency. - */ - case class Frequency(val times: Int, val unit: Option[TemporalUnit] = None) { - - /** - * Unifies this frequency with another frequency. - * - * Currently only allows identical frequencies to be unified. - */ - def &(that: Frequency): Frequency = { - if (this == that && this.unit.isEmpty) { - this - } else { - throw new IllegalArgumentException( - "cannot combine %s and %s".format(this, that)) - } - } - } - - /** - * A quantifier like "every" or "each". - * - * @constructor Creates a quantifier from a string - * @param timeMLValue A - * [[http://timeml.org/site/publications/timeMLdocs/timeml_1.2.1.html#timex3 TIMEX3 quant attribute]] - * string. - */ - abstract class Quantifier(val timeMLValue: Option[String]) { - - /** - * Unifies this quantifier with another quantifier. - * - * Currently only allows identical quantifiers to be unified. - */ - def &(that: Quantifier): Quantifier = { - if (this == that && this.timeMLValue.isEmpty) { - this - } else { - throw new IllegalArgumentException( - "cannot combine %s and %s".format(this, that)) - } - } - } - - /** - * Provider of different of [[Quantifier]] instances. - */ - object Quantifier { - - /** - * The absence of a quantifier - */ - case object None extends Quantifier(scala.None) - - /** - * A quantifier for the meaning of "every" - */ - case object Every extends Quantifier(Some("EVERY")) - - /** - * A quantifier for the meaning of "each" - */ - case object Each extends Quantifier(Some("EACH")) - - private val values = Seq[Quantifier](None, Every, Each) - - private val stringToQuantifier = - (for (quantifier <- values; name <- quantifier.timeMLValue) yield name -> quantifier).toMap - - /** - * Gets the quantifier corresponding to a string value. - * - * @param timeMLValue A - * [[http://timeml.org/site/publications/timeMLdocs/timeml_1.2.1.html#timex3 TIMEX3 quant attribute]] - * string. - * @return The quantifier for the given string. - */ - def valueOf(timeMLValue: String): Quantifier = this.stringToQuantifier(timeMLValue) - } -} - -/** - * An anchored span of time, such as "2011" or "April 25, 1980". - * - * @constructor Creates a new time span from start and end points. - * @param start The start point of the time span. The span is assumed to include this point. - * @param end The end point of the time span. The span is assumed to end right before this point. - * @param period The period between the start and end points. This could be derived from the start - * and end, but then there would be no way to store differentiate between two - * representations of the same period (e.g. 7 days vs. 1 week), which matters for generating - * TimeML values. - * @param modifier A modifier if the time span is not exact. - */ -case class TimeSpan( - start: ZonedDateTime, - end: ZonedDateTime, - period: Period, - modifier: Modifier) extends Temporal { - - /** - * The time span, formatted as a - * [[http://timeml.org/site/publications/timeMLdocs/timeml_1.2.1.html#timex3 TIMEX3 value attribute]] - * if possible. - * - * Time spans that are impossible to represent in a TIMEX3 value (e.g. "the last three weeks") - * will produce `None`. - */ - def timeMLValueOption: Option[String] = { - if (this.start == this.end) { - Some(this.start.toLocalDateTime.toString) - } else { - this.period.unitAmounts.toList match { - case List((unit, 1)) if TimeSpan.truncate(this.start, unit) == this.start => - val fields = TimeSpan.unitToFieldsToDisplay.get(unit) match { - case None => throw new UnsupportedOperationException("Don't know how to display " + unit) - case Some(fields) => fields - } - val parts = for (field <- fields) yield { - TimeSpan.fieldFormats.get(field) match { - case None => throw new UnsupportedOperationException("Don't know how to format " + field) - case Some(format) => format(this.start.get(field)) - } - } - Some(parts.mkString) - case _ => None - } - } - } - - /** - * The time span, formatted as a - * [[http://timeml.org/site/publications/timeMLdocs/timeml_1.2.1.html#timex3 TIMEX3 value attribute]] - * if possible. - * - * Time spans that are impossible to represent in a TIMEX3 value (e.g. "the last three weeks") - * will produce the TIMEX3 value for their period (e.g. "three weeks"). - */ - val timeMLValue = this.timeMLValueOption.getOrElse(this.period.timeMLValue) -} - -/** - * Factory for [[TimeSpan]] instances. - */ -object TimeSpan { - - /** - * The time point representing an unspecified start point. - */ - final val unspecifiedStart = ZonedDateTime.of(LocalDateTime.MIN, ZoneId.of("Z")) - - /** - * The time point representing an unspecified end point. - */ - final val unspecifiedEnd = ZonedDateTime.of(LocalDateTime.MAX, ZoneId.of("Z")) - - /** - * Creates a [[TimeSpan]] from a single day. - * - * @param year The time span's year. - * @param month The time span's month. - * @param day The time span's day. - * @return A time span lasting for exactly the given day. - */ - def of(year: Int, month: Int, day: Int): TimeSpan = { - val start = ZonedDateTime.of(LocalDateTime.of(year, month, day, 0, 0), ZoneId.of("Z")) - this.startingAt(start, Period(Map(DAYS -> 1)), Modifier.Exact) - } - - /** - * Creates a [[TimeSpan]] from a single second. - * - * @param year The time span's year. - * @param month The time span's month. - * @param day The time span's day. - * @param hour The time span's hour. - * @param minute The time span's minute. - * @param second The time span's second. - * @return A time span lasting for exactly the given second. - */ - def of(year: Int, month: Int, day: Int, hour: Int, minute: Int, second: Int): TimeSpan = { - val localStart = LocalDateTime.of(year, month, day, hour, minute, second) - val start = ZonedDateTime.of(localStart, ZoneId.of("Z")) - this.startingAt(start, Period(Map(SECONDS -> 1)), Modifier.Exact) - } - - /** - * Creates a [[TimeSpan]] from a TimeML value string. - * - * @param value A [[http://timeml.org/site/publications/timeMLdocs/timeml_1.2.1.html#timex3 TIMEX3 value attribute]] - * string. The value must be a date/time, not a period/duration. - * @return The time span corresponding to the TimeML value. - */ - def fromTimeMLValue(value: String): TimeSpan = { - val fieldValues: Map[TemporalField, Int] = value.split("[-T:]") match { - case Array(centuryOrDecadeOrYear) => centuryOrDecadeOrYear.length match { - case 2 => Map(CENTURY -> centuryOrDecadeOrYear.toInt) - case 3 => Map(DECADE -> centuryOrDecadeOrYear.toInt) - case 4 => Map(YEAR -> centuryOrDecadeOrYear.toInt) - } - case Array(year, seasonOrQuarterOrMonthOrWeek) => Map[TemporalField, Int](YEAR -> year.toInt) ++ { - seasonOrQuarterOrMonthOrWeek match { - case "SP" => Map(SPRING_OF_YEAR -> 1) - case "SU" => Map(SUMMER_OF_YEAR -> 1) - case "FA" => Map(FALL_OF_YEAR -> 1) - case "WI" => Map(WINTER_OF_YEAR -> 1) - case _ => seasonOrQuarterOrMonthOrWeek.head match { - case 'W' => Map(ISO_WEEK.OF_YEAR -> seasonOrQuarterOrMonthOrWeek.tail.toInt) - case 'Q' => Map(QUARTER_OF_YEAR -> seasonOrQuarterOrMonthOrWeek.tail.toInt) - case _ => Map(MONTH_OF_YEAR -> seasonOrQuarterOrMonthOrWeek.toInt) - } - } - } - case Array(year, monthOrWeek, dayOrWeekend) => Map[TemporalField, Int](YEAR -> year.toInt) ++ { - monthOrWeek.head match { - case 'W' => dayOrWeekend match { - case "WE" => Map(ISO_WEEK.OF_YEAR -> monthOrWeek.tail.toInt, WEEKEND_OF_WEEK -> 1) - } - case _ => Map(MONTH_OF_YEAR -> monthOrWeek.toInt, DAY_OF_MONTH -> dayOrWeekend.toInt) - } - } - case Array(year, month, day, hourOrPartOfDay) => - Map[TemporalField, Int](YEAR -> year.toInt, MONTH_OF_YEAR -> month.toInt, DAY_OF_MONTH -> day.toInt) ++ { - hourOrPartOfDay match { - case "MO" => Map(MORNING_OF_DAY -> 1) - case "AF" => Map(AFTERNOON_OF_DAY -> 1) - case "EV" => Map(EVENING_OF_DAY -> 1) - case "NI" => Map(NIGHT_OF_DAY -> 1) - case hour => Map(HOUR_OF_DAY -> hour.toInt) - } - } - case Array(year, month, day, hour, minute) => - Map(YEAR -> year.toInt, MONTH_OF_YEAR -> month.toInt, DAY_OF_MONTH -> day.toInt, - HOUR_OF_DAY -> hour.toInt, MINUTE_OF_HOUR -> minute.toInt) - case Array(year, month, day, hour, minute, second) => - Map(YEAR -> year.toInt, MONTH_OF_YEAR -> month.toInt, DAY_OF_MONTH -> day.toInt, - HOUR_OF_DAY -> hour.toInt, MINUTE_OF_HOUR -> minute.toInt, SECOND_OF_MINUTE -> second.toInt) - case _ => throw new Exception("%s %s".format(value, value.split("[-T]").toList)) - } - - // set all the requested fields - val zero = ZonedDateTime.of(LocalDateTime.of(1, 1, 1, 0, 0), ZoneId.of("Z")) - val nonTruncatedStart = fieldValues.foldLeft(zero) { - case (dateTime, (field, value)) => dateTime.`with`(field, value) - } - - // truncate the date-time based on the smallest field's base unit - val minField = fieldValues.keySet.minBy(_.getBaseUnit().getDuration()) - val minUnit = minField.getBaseUnit() - val start = this.truncate(nonTruncatedStart, minUnit) - - // for things that overlap the boundary (e.g. NIGHT_OF_DAY) truncation will move them to - // the previous range (e.g. the previous day) so we'll need to move them back - val isNotTooEarly = fieldValues.forall { case (field, value) => start.get(field) == value } - val adjustedStart = if (isNotTooEarly) start else start.plus(1, minField.getRangeUnit()) - - // create a time span of exactly one unit in size - this.startingAt(adjustedStart, Period(Map(minUnit -> 1)), Modifier.Exact) - } - - /** - * Creates a [[TimeSpan]] from a start point and a period. - * - * @param start The start point of the time span. - * @param period The duration of the time span. - * @param modifier The modifier of the time span, or [[Modifier.Exact]] if the span is exact. - * @return A time span starting at the given point and lasting for the given period. - */ - def startingAt(start: ZonedDateTime, period: Period, modifier: Modifier): TimeSpan = { - TimeSpan(start, period.addTo(start), period, modifier) - } - - /** - * Creates a [[TimeSpan]] from an end point and a period. - * - * @param end The end point of the time span. - * @param period The duration of the time span. - * @param modifier The modifier of the time span, or [[Modifier.Exact]] if the span is exact. - * @return A time span ending at the given point and lasting for the given period. - */ - def endingAt(end: ZonedDateTime, period: Period, modifier: Modifier): TimeSpan = { - TimeSpan(period.subtractFrom(end), end, period, modifier) - } - - private[timenorm] def truncate(time: ZonedDateTime, unit: TemporalUnit): ZonedDateTime = { - this.unitToFieldsToTruncate.get(unit) match { - case None => throw new UnsupportedOperationException("Don't know how to truncate " + unit) - case Some(fields) => fields.foldLeft(time) { - case (time, field) => { - val nUnits = time.get(field) - field.range.getMinimum - time.minus(nUnits, field.getBaseUnit) - } - } - } - } - - private[timenorm] val fieldFormats = Map[TemporalField, Int => String]( - (CENTURY, "%02d".format(_)), - (DECADE, "%03d".format(_)), - (YEAR, "%04d".format(_)), - (QUARTER_OF_YEAR, "-Q%d".format(_)), - (SPRING_OF_YEAR, _ match { case 1 => "-SP" }), - (SUMMER_OF_YEAR, _ match { case 1 => "-SU" }), - (FALL_OF_YEAR, _ match { case 1 => "-FA" }), - (WINTER_OF_YEAR, _ match { case 1 => "-WI" }), - (MONTH_OF_YEAR, "-%02d".format(_)), - (DAY_OF_MONTH, "-%02d".format(_)), - (ISO_WEEK.OF_YEAR, "-W%02d".format(_)), - (DAY_OF_WEEK, "-%d".format(_)), - (WEEKEND_OF_WEEK, _ match { case 1 => "-WE" }), - (MORNING_OF_DAY, _ match { case 1 => "TMO" }), - (AFTERNOON_OF_DAY, _ match { case 1 => "TAF" }), - (EVENING_OF_DAY, _ match { case 1 => "TEV" }), - (NIGHT_OF_DAY, _ match { case 1 => "TNI" }), - (HOUR_OF_DAY, "T%02d".format(_)), - (MINUTE_OF_HOUR, ":%02d".format(_)), - (SECOND_OF_MINUTE, ":%02d".format(_))) - - private val unitToFieldsToDisplay = Map[TemporalUnit, Seq[TemporalField]]( - CENTURIES -> Seq(CENTURY), - DECADES -> Seq(DECADE), - YEARS -> Seq(YEAR), - QUARTER_YEARS -> Seq(YEAR, QUARTER_OF_YEAR), - SPRINGS -> Seq(YEAR, SPRING_OF_YEAR), - SUMMERS -> Seq(YEAR, SUMMER_OF_YEAR), - FALLS -> Seq(YEAR, FALL_OF_YEAR), - WINTERS -> Seq(YEAR, WINTER_OF_YEAR), - MONTHS -> Seq(YEAR, MONTH_OF_YEAR), - WEEKS -> Seq(YEAR, ISO_WEEK.OF_YEAR), - WEEKENDS -> Seq(YEAR, ISO_WEEK.OF_YEAR, WEEKEND_OF_WEEK), - DAYS -> Seq(YEAR, MONTH_OF_YEAR, DAY_OF_MONTH), - MORNINGS -> Seq(YEAR, MONTH_OF_YEAR, DAY_OF_MONTH, MORNING_OF_DAY), - AFTERNOONS -> Seq(YEAR, MONTH_OF_YEAR, DAY_OF_MONTH, AFTERNOON_OF_DAY), - EVENINGS -> Seq(YEAR, MONTH_OF_YEAR, DAY_OF_MONTH, EVENING_OF_DAY), - NIGHTS -> Seq(YEAR, MONTH_OF_YEAR, DAY_OF_MONTH, NIGHT_OF_DAY), - HOURS -> Seq(YEAR, MONTH_OF_YEAR, DAY_OF_MONTH, HOUR_OF_DAY), - MINUTES -> Seq(YEAR, MONTH_OF_YEAR, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE_OF_HOUR), - SECONDS -> Seq(YEAR, MONTH_OF_YEAR, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE_OF_HOUR, SECOND_OF_MINUTE)) - - private val unitToFieldsToTruncate = Map[TemporalUnit, Seq[TemporalField]]( - CENTURIES -> Seq(YEAR_OF_CENTURY, MONTH_OF_YEAR, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE_OF_HOUR, SECOND_OF_MINUTE), - DECADES -> Seq(YEAR_OF_DECADE, MONTH_OF_YEAR, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE_OF_HOUR, SECOND_OF_MINUTE), - YEARS -> Seq(MONTH_OF_YEAR, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE_OF_HOUR, SECOND_OF_MINUTE), - QUARTER_YEARS -> Seq(DAY_OF_QUARTER, HOUR_OF_DAY, MINUTE_OF_HOUR, SECOND_OF_MINUTE), - SPRINGS -> Seq(DAY_OF_SPRING, HOUR_OF_DAY, MINUTE_OF_HOUR, SECOND_OF_MINUTE), - SUMMERS -> Seq(DAY_OF_SUMMER, HOUR_OF_DAY, MINUTE_OF_HOUR, SECOND_OF_MINUTE), - FALLS -> Seq(DAY_OF_FALL, HOUR_OF_DAY, MINUTE_OF_HOUR, SECOND_OF_MINUTE), - WINTERS -> Seq(DAY_OF_WINTER, HOUR_OF_DAY, MINUTE_OF_HOUR, SECOND_OF_MINUTE), - MONTHS -> Seq(DAY_OF_MONTH, HOUR_OF_DAY, MINUTE_OF_HOUR, SECOND_OF_MINUTE), - WEEKS -> Seq(DAY_OF_WEEK, HOUR_OF_DAY, MINUTE_OF_HOUR, SECOND_OF_MINUTE), - WEEKENDS -> Seq(DAY_OF_WEEKEND, HOUR_OF_DAY, MINUTE_OF_HOUR, SECOND_OF_MINUTE), - DAYS -> Seq(HOUR_OF_DAY, MINUTE_OF_HOUR, SECOND_OF_MINUTE), - MORNINGS -> Seq(HOUR_OF_MORNING, MINUTE_OF_HOUR, SECOND_OF_MINUTE), - AFTERNOONS -> Seq(HOUR_OF_AFTERNOON, MINUTE_OF_HOUR, SECOND_OF_MINUTE), - EVENINGS -> Seq(HOUR_OF_EVENING, MINUTE_OF_HOUR, SECOND_OF_MINUTE), - NIGHTS -> Seq(HOUR_OF_NIGHT, MINUTE_OF_HOUR, SECOND_OF_MINUTE), - HOURS -> Seq(MINUTE_OF_HOUR, SECOND_OF_MINUTE), - MINUTES -> Seq(SECOND_OF_MINUTE), - SECONDS -> Seq()) -} - -/** - * A set of time spans, such as "Mondays" or "October each year". - * - * @constructor Creates a new time span set from a mapping of field values. - * @param fields A mapping from temporal fields to field values. All known field values should be - * provided here; temporal fields with unknown values should be absent from the map. For - * example, `Map(DAY_OF_WEEK -> 1)` would represent "Mondays". - */ -case class TimeSpanSet(fields: Map[TemporalField, Int]) extends Temporal { - val timeMLValue: String = { - val (timeFields, dayFields) = fields.keySet.partition(_.getBaseUnit().getDuration().compareTo(DAYS.getDuration()) < 0) - val minDayField = - if (dayFields.isEmpty) DAY_OF_MONTH - else dayFields.minBy(_.getBaseUnit().getDuration()) - val dayFieldsToDisplay = TimeSpanSet.fieldToDayFieldsToDisplay(minDayField) - val timeFieldsToDisplay = - if (timeFields.isEmpty) Seq.empty[TemporalField] - else TimeSpanSet.fieldToTimeFieldsToDisplay(timeFields.minBy(_.getBaseUnit().getDuration())) - val fieldsToDisplay = dayFieldsToDisplay ++ timeFieldsToDisplay - val parts = - for (field <- fieldsToDisplay) yield fields.get(field) match { - case Some(value) => TimeSpan.fieldFormats(field)(value) - case None => TimeSpanSet.unspecifiedFieldFormats(field) - } - parts.mkString - } -} - - -private object TimeSpanSet { - - private val fieldToDayFieldsToDisplay = Map[TemporalField, Seq[TemporalField]]( - CENTURY -> Seq(CENTURY), - DECADE -> Seq(DECADE), - YEAR -> Seq(YEAR), - QUARTER_OF_YEAR -> Seq(YEAR, QUARTER_OF_YEAR), - SPRING_OF_YEAR -> Seq(YEAR, SPRING_OF_YEAR), - SUMMER_OF_YEAR -> Seq(YEAR, SUMMER_OF_YEAR), - FALL_OF_YEAR -> Seq(YEAR, FALL_OF_YEAR), - WINTER_OF_YEAR -> Seq(YEAR, WINTER_OF_YEAR), - MONTH_OF_YEAR -> Seq(YEAR, MONTH_OF_YEAR), - ISO_WEEK.OF_YEAR -> Seq(YEAR, ISO_WEEK.OF_YEAR), - WEEKEND_OF_WEEK -> Seq(YEAR, ISO_WEEK.OF_YEAR, WEEKEND_OF_WEEK), - DAY_OF_WEEK -> Seq(YEAR, ISO_WEEK.OF_YEAR, DAY_OF_WEEK), - DAY_OF_MONTH -> Seq(YEAR, MONTH_OF_YEAR, DAY_OF_MONTH)) - - private val fieldToTimeFieldsToDisplay = Map[TemporalField, Seq[TemporalField]]( - MORNING_OF_DAY -> Seq(MORNING_OF_DAY), - AFTERNOON_OF_DAY -> Seq(AFTERNOON_OF_DAY), - EVENING_OF_DAY -> Seq(EVENING_OF_DAY), - NIGHT_OF_DAY -> Seq(NIGHT_OF_DAY), - HOUR_OF_DAY -> Seq(HOUR_OF_DAY), - MINUTE_OF_HOUR -> Seq(HOUR_OF_DAY, MINUTE_OF_HOUR), - SECOND_OF_MINUTE -> Seq(HOUR_OF_DAY, MINUTE_OF_HOUR, SECOND_OF_MINUTE)) - - private val unspecifiedFieldFormats = Map[TemporalField, String]( - (CENTURY, "XX"), - (DECADE, "XXX"), - (YEAR, "XXXX"), - (MONTH_OF_YEAR, "-XX"), - (DAY_OF_MONTH, "-XX"), - (ISO_WEEK.OF_YEAR, "-WXX"), - (HOUR_OF_DAY, "TXX"), - (MINUTE_OF_HOUR, ":XX"), - (SECOND_OF_MINUTE, ":XX")) -} - -/** - * A temporal modifier, such as "approximately" or "less than". - * - * Modifier types are provided by the [[Modifier$ Modifier]] companion object. - * - * @constructor Creates a new temporal modifier. - * @param timeMLValueOption The string value of the modifier or None for no modifier. - */ -abstract class Modifier(val timeMLValueOption: Option[String]) { - - /** - * Unifies this modifier with another modifier. - * - * Currently only allows modifiers to be unified with [[Modifier.Exact]]. - */ - def &(that: Modifier): Modifier = { - if (this == that) { - this - } else if (this == Modifier.Exact) { - that - } else if (that == Modifier.Exact) { - this - } else { - throw new IllegalArgumentException( - "cannot combine %s and %s".format(this, that)) - } - } -} - -/** - * Provides [[Modifier]] instances. - */ -object Modifier { - case object Exact extends Modifier(None) - case object Before extends Modifier(Some("BEFORE")) - case object After extends Modifier(Some("AFTER")) - case object OnOrBefore extends Modifier(Some("ON_OR_BEFORE")) - case object OnOrAfter extends Modifier(Some("ON_OR_AFTER")) - case object LessThan extends Modifier(Some("LESS_THAN")) - case object MoreThan extends Modifier(Some("MORE_THAN")) - case object EqualOrLess extends Modifier(Some("EQUAL_OR_LESS")) - case object EqualOrMore extends Modifier(Some("EQUAL_OR_MORE")) - case object Start extends Modifier(Some("START")) - case object Mid extends Modifier(Some("MID")) - case object End extends Modifier(Some("END")) - case object Approx extends Modifier(Some("APPROX")) - - private val values = Seq[Modifier]( - Exact, - Before, - After, - OnOrBefore, - OnOrAfter, - LessThan, - MoreThan, - EqualOrLess, - EqualOrMore, - Start, - Mid, - End, - Approx) - - private val stringToModifier = - (for (modifier <- values; value <- modifier.timeMLValueOption) yield value -> modifier).toMap - - /** - * Gets the modifier corresponding to a string value. - * - * @param timeMLValue A - * [[http://timeml.org/site/publications/timeMLdocs/timeml_1.2.1.html#timex3 TIMEX3 mod attribute]] - * string. - * @return The modifier for the given string. - */ - def valueOf(timeMLValue: String): Modifier = this.stringToModifier(timeMLValue) -} diff --git a/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/TemporalExpressionParser.scala b/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/TemporalExpressionParser.scala deleted file mode 100755 index a88eb19..0000000 --- a/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/TemporalExpressionParser.scala +++ /dev/null @@ -1,590 +0,0 @@ -package org.clulab.timenorm.scfg - -import java.io.File -import java.net.URL -import java.text.Normalizer -import java.time.temporal.IsoFields.QUARTER_YEARS -import java.time.{DateTimeException, LocalDate} -import java.util.logging.Logger - -import scala.collection.immutable.IndexedSeq -import scala.io.Source -import scala.util.{Failure, Success, Try} - -object TemporalExpressionParser { - - /** The built-in English time parser. - */ - def en(): TemporalExpressionParser = new TemporalExpressionParser( - grammarURL = this.getClass.getResource("/org/clulab/timenorm/en.grammar"), - tokenize = DefaultTokenizer - ) - - /** The built-in Italian time parser. - */ - def it(): TemporalExpressionParser = new TemporalExpressionParser( - grammarURL = this.getClass.getResource("/org/clulab/timenorm/it.grammar"), - tokenize = ItalianTokenizer - ) - - /** The built-in Spanish time parser. - */ - def es(): TemporalExpressionParser = new TemporalExpressionParser( - grammarURL = this.getClass.getResource("/org/clulab/timenorm/es.grammar"), - tokenize = DefaultTokenizer - ) - - /** Runs a demo of TemporalExpressionParser that reads time expressions from - * standard input and writes their normalized forms to standard output. - * - * Note: This is only provided for demonstrative purposes. - */ - def main(args: Array[String]): Unit = { - - // create the parser, using a grammar file if specified - val parser = args match { - case Array() => - new TemporalExpressionParser - case Array(grammarPath) => - new TemporalExpressionParser(new File(grammarPath).toURI.toURL) - case _ => - System.err.printf( - "usage: %s [grammar-file]", - this.getClass.getSimpleName - ) - System.exit(1) - throw new IllegalArgumentException - } - - // use the current date as an anchor - val now = LocalDate.now() - val anchor = TimeSpan.of(now.getYear, now.getMonthValue, now.getDayOfMonth) - System.out.printf("Assuming anchor: %s\n", anchor.timeMLValue) - System.out.println("Type in a time expression (or :quit to exit)") - - // repeatedly prompt for a time expression and then try to parse it - System.out.print(">>> ") - for (line <- Source.stdin.getLines.takeWhile(_ != ":quit")) { - parser.parse(line, anchor) match { - case Failure(exception) => - System.out.printf("Error: %s\n", exception.getMessage) - case Success(temporal) => - System.out.println(temporal.timeMLValue) - } - System.out.print(">>> ") - } - } -} - -/** A parser for natural language expressions of time, based on a synchronous - * context free grammar. Typical usage: - * {{{ - * // create a new parser (using the default English grammar) - * val parser = new TemporalExpressionParser - * // establish an anchor time - * val anchor = TimeSpan.of(2013, 1, 4) - * // parse an expression given an anchor time (assuming here that it succeeds) - * val Success(temporal) = parser.parse("two weeks ago", anchor) - * // get the TimeML value ("2012-W51") from the Temporal - * val value = temporal.timeMLValue - * }}} - * - * @constructor - * Creates a parser from a URL to a grammar file. - * @param grammarURL - * The URL of a grammar file, in [[SynchronousGrammar.fromString]] format. If - * not specified, the default English grammar on the classpath is used. Note - * that if another grammar is specified, it may be necessary to override the - * [[tokenize]] method. - * @param tokenize - * A function that splits a string into tokens. The default tokenizer is - * appropriate for the default English grammar. Other languages may require - * alternate tokenizers. - */ -class TemporalExpressionParser( - grammarURL: URL = classOf[TemporalExpressionParser].getResource( - "/org/clulab/timenorm/en.grammar" - ), - tokenize: String => IndexedSeq[String] = DefaultTokenizer -) { - private val logger = Logger.getLogger(this.getClass.getName) - private val grammarText = Source.fromURL(grammarURL, "UTF-8").mkString - private val grammar = SynchronousGrammar.fromString(grammarText) - private val sourceSymbols = grammar.sourceSymbols() - private val parser = new SynchronousParser(grammar) - - /** Tries to parse a source string into a single [[Temporal]] object. - * - * @param sourceText - * The input string in the source language. - * @param anchor - * The anchor time (required for resolving relative times like "today"). - * @return - * The most likely [[Temporal]] parse according to the parser's heuristic. - */ - def parse(sourceText: String, anchor: TimeSpan): Try[Temporal] = { - this.parseAll(sourceText, anchor).map(_.head) - } - - /** Try to parse a source string into possible [[Temporal]] objects. - * - * @param sourceText - * The input string in the source language. - * @param anchor - * The anchor time (required for resolving relative times like "today"). - * @return - * A sequence of [[Temporal]] objects representing the possible parses. The - * sequence is sorted by a heuristic that tries to put the most promising - * parses first. - */ - def parseAll(sourceText: String, anchor: TimeSpan): Try[Seq[Temporal]] = { - // tokenize the string, filtering out any tokens not in the grammar - val tokens = this.tokenize(sourceText).filter { token => - this.sourceSymbols.contains(token) || SynchronousGrammar.isNumber(token) - } - - // parse the tokens into TemporalParses, failing if there is a syntactic error - val parsesTry = - try { - val trees = this.parser.parseAll(tokens) - // two unique trees can generate the same TemporalParse, so remove duplicates - Success(trees.map(TemporalParse).toSet) - } catch { - case e: UnsupportedOperationException => Failure(e) - } - - // if there was no syntactic error, convert the TemporalParses to Temporals - parsesTry match { - case Failure(e) => Failure(e) - - case Success(parses) => - // assume that the grammar ambiguity for any expression is at most 2 - if (parses.size > 2) { - val message = - "Expected no more than 2 parses for \"%s\", found:\n %s" - this.logger.warning( - message.format(sourceText, parses.mkString("\n ")) - ) - } - - // try to convert each TemporalParse to a Temporal - val temporalTries = for (parse <- parses) yield { - try { - Success(parse match { - case parse: PeriodParse => parse.toPeriod - case parse: PeriodSetParse => parse.toPeriodSet - case parse: TimeSpanParse => parse.toTimeSpan(anchor) - case parse: TimeSpanSetParse => parse.toTimeSpanSet - }) - } catch { - case e @ (_: UnsupportedOperationException | - _: DateTimeException) => - Failure(e) - } - } - - // if there all TemporalParses had semantic errors, fail - val temporals = temporalTries.collect { case Success(temporal) => - temporal - } - - if (temporals.isEmpty) { - temporalTries.collect { case Failure(e) => Failure(e) }.head - } - // otherwise, sort the Temporals by the heuristic - else { - // val timeMLs = - // for (temporal <- temporals) - // yield temporal.timeMLValue - // val forPrints = temporals zip timeMLs - // println("TimeML Value \t Raw Parse") - // forPrints.foreach { case (temporal, timeML) => - // println(s"$timeML \t $temporal") - // } - - val finalAnswers = temporals.toSeq.sorted(this.heuristicFor(anchor)) - if (parses.size > 2){ - val finalAnswer = finalAnswers.head - val finalMLValue = finalAnswer.timeMLValue - this.logger.warning( - s"final answer for the parses $finalMLValue" - ) - } - Success(finalAnswers) - } - - } - } - - // a heuristic for selecting between ambiguous parses - private def heuristicFor(anchor: TimeSpan): Ordering[Temporal] = { - val isQuarter = (timeSpan: TimeSpan) => - timeSpan.period.unitAmounts.keySet == Set(QUARTER_YEARS) - val anchorIsQuarter = isQuarter(anchor) - Ordering.fromLessThan[Temporal] { - // prefer time spans to periods - case (period: Period, timeSpan: TimeSpan) => - false - case (timeSpan: TimeSpan, period: Period) => - true - // if the anchor is in quarters, prefer a result in quarters - // otherwise, prefer earlier time spans - case (timeSpan1: TimeSpan, timeSpan2: TimeSpan) => - (anchorIsQuarter, isQuarter(timeSpan1), isQuarter(timeSpan2)) match { - case (true, true, false) => - true - case (true, false, true) => - false - case _ => - val span1Dist = (anchor.start.toEpochSecond() - timeSpan1.start - .toEpochSecond()).abs - val span2Dist = (anchor.start.toEpochSecond() - timeSpan2.start - .toEpochSecond()).abs - span1Dist < span2Dist - } - // throw an exception for anything else - case other => - throw new UnsupportedOperationException( - "Don't know how to order " + other - ) - } - } -} - -/** Splits a string into tokens to be used as input for the synchronous parser. - * - * This tokenizer is appropriate for the default English grammar. - */ -object DefaultTokenizer extends (String => IndexedSeq[String]) { - final val wordBoundary = "\\b".r - final val letterNonLetterBoundary = - "(?<=[^\\p{L}])(?=[\\p{L}])|(?<=[\\p{L}])(?=[^\\p{L}])".r - - def apply(sourceText: String): IndexedSeq[String] = { - val tokens = - for (untrimmedWord <- this.wordBoundary.split(sourceText).toIndexedSeq) - yield { - val word = untrimmedWord.trim - if (word.isEmpty) { - IndexedSeq.empty[String] - } - // special case for concatenated YYYYMMDD - else if (word.matches("^\\d{8}$")) { - IndexedSeq( - word.substring(0, 4), - "-", - word.substring(4, 6), - "-", - word.substring(6, 8) - ) - } - // special case for concatenated YYMMDD - else if (word.matches("^\\d{6}$")) { - IndexedSeq( - word.substring(0, 2), - "-", - word.substring(2, 4), - "-", - word.substring(4, 6) - ) - } - // special case for concatenated HHMMTZ - else if (word.matches("^\\d{4}[A-Z]{3,4}$")) { - IndexedSeq( - word.substring(0, 2), - ":", - word.substring(2, 4), - word.substring(4).toLowerCase - ) - } - // otherwise, split at all letter/non-letter boundaries - else { - this.letterNonLetterBoundary - .split(word) - .toIndexedSeq - .map(_.trim.toLowerCase) - .filterNot(_.isEmpty) - } - } - tokens.flatten - } -} - -object ItalianTokenizer extends (String => IndexedSeq[String]) { - - def apply(sourceText: String): IndexedSeq[String] = { - val cleanedText = Normalizer - .normalize(sourceText, Normalizer.Form.NFD) - .replaceAll("\\p{InCombiningDiacriticalMarks}+", "") - val tokens = - for ( - untrimmedWord <- DefaultTokenizer.wordBoundary - .split(cleanedText) - .toIndexedSeq - ) yield { - val word = untrimmedWord.trim - if (word.isEmpty) { - IndexedSeq.empty[String] - } - // special case for concatenated YYYYMMDD - else if (word.matches("^\\d{8}$")) { - IndexedSeq( - word.substring(0, 4), - "-", - word.substring(4, 6), - "-", - word.substring(6, 8) - ) - } - // special case for concatenated YYMMDD - else if (word.matches("^\\d{6}$")) { - IndexedSeq( - word.substring(0, 2), - "-", - word.substring(2, 4), - "-", - word.substring(4, 6) - ) - } - // special case for concatenated HHMMTZ - else if (word.matches("^\\d{4}[A-Z]{3,4}$")) { - IndexedSeq( - word.substring(0, 2), - ":", - word.substring(2, 4), - word.substring(4).toLowerCase - ) - } - // special case for numbers in Italian - else if ( - word.matches("^[Dd]ue(cen|mil)\\w+$") || word - .matches("^[Tt]re(cen|mil)\\w+$") || - word.matches("^[Qq]uattro(cen|mil)\\w+$") || word - .matches("^[Cc]inque(cen|mil)\\w+$") || - word.matches("^[Ss]ei(cen|mil)\\w+$") || word - .matches("^[Ss]ette(cen|mil)\\w+$") || - word.matches("^[Oo]tto(cen|mil)\\w+$") || word - .matches("^[Nn]ove(cen|mil)\\w+$") || - word.matches("^[Dd]ieci(mil)\\w+$") || - word.matches("^[Cc]ento\\w+$") || word.matches("^[Mm]ille\\w+$") || - word.matches("^[Vv]ent\\w+$") || word.matches("^[Tt]rent\\w+$") || - word.matches("^[Qq]uarant\\w+$") || word - .matches("^[Cc]inquant\\w+$") || - word.matches("^[Ss]essant\\w+$") || word - .matches("^[Ss]ettant\\w+$") || - word.matches("^[Oo]ttant\\w+$") || word.matches("^[Nn]ovant\\w+$") || - word.matches("^[Dd]eci\\w+$") || word.matches("^[Uu]ndici\\w+$") || - word.matches("^[Dd]odici\\w+$") || word.matches("^[Tt]redici\\w+$") || - word.matches("^[Qq]uattordici\\w+$") || word - .matches("^[Qq]uindici\\w+$") || - word.matches("^[Ss]edici\\w+$") || word - .matches("^[Dd]iciassette\\w+$") || - word.matches("^[Dd]iciotto\\w+$") || word - .matches("^[Dd]iciannove\\w+$") - ) { - this.tokenizeItalianNumber(word) - } else if ( - word.matches("^[Dd]eg?l?i?$") || word.matches("^[Dd]ell[oae]$") - ) { - IndexedSeq("dell") - } else if ( - word.matches("^[Aa]g?l?i?$") || word.matches("^[Aa]ll[oae]$") - ) { - IndexedSeq("all") - } else if (word.matches("^([Ii]|[Gg]li|[Ll]e)$")) { // definite plural - IndexedSeq("le") - } else if (word.matches("^[Qq]uest[oaei]$")) { - IndexedSeq("quest") - } else if ( - word.matches("^[Qq]ueg?l?i?$") || word.matches("^[Qq]uell[oaei]$") - ) { - IndexedSeq("quell") - } else if (word.matches("^[Ss]cors[oaie]$")) { - IndexedSeq("scorsx") - } else if (word.matches("^[Pp]assat[oaie]$")) { - IndexedSeq("passatx") - } else if (word.matches("^[Uu]ltim[oaie]$")) { - IndexedSeq("ultimx") - } else if (word.matches("^[Pp]recedent[ei]$")) { - IndexedSeq("precedentx") - } else if (word.matches("^[Pp]rossim[oaie]$")) { - IndexedSeq("prossimx") - } else if (word.matches("^[Ss]uccessiv[oaie]$")) { - IndexedSeq("successivx") - } else if (word.matches("^[Ss]eguent[ei]$")) { - IndexedSeq("seguentx") - } else if (word.matches("^[Ee]ntrant[ei]$")) { - IndexedSeq("entrantx") - } else if (word.matches("^[Vv]entur[oaie]$")) { - IndexedSeq("venturx") - } else if (word.matches("^[Ff]utur[oaie]$")) { - IndexedSeq("futurx") - } else if (word.matches("^[Tt]utt[ie]$")) { - IndexedSeq("tutti") - } - // otherwise, split at all letter/non-letter boundaries - else { - DefaultTokenizer.letterNonLetterBoundary - .split(word) - .toIndexedSeq - .map(_.trim.toLowerCase) - .filterNot(_.isEmpty) - } - } - tokens.flatten - } - - protected def tokenizeItalianNumber(word: String): Seq[String] = { - if (word.isEmpty) { - IndexedSeq.empty[String] - } else if (word.matches("^[Dd]ue(cen|mil)\\w+$")) { - IndexedSeq("due") ++ this.tokenizeItalianNumber( - word.substring(3).toLowerCase - ) - } else if (word.matches("^[Tt]re(cen|mil)\\w+$")) { - IndexedSeq("tre") ++ this.tokenizeItalianNumber( - word.substring(3).toLowerCase - ) - } else if (word.matches("^[Qq]uattro(cen|mil)\\w+$")) { - IndexedSeq("quattro") ++ this.tokenizeItalianNumber( - word.substring(7).toLowerCase - ) - } else if (word.matches("^[Cc]inque(cen|mil)\\w+$")) { - IndexedSeq("cinque") ++ this.tokenizeItalianNumber( - word.substring(6).toLowerCase - ) - } else if (word.matches("^[Ss]ei(cen|mil)\\w+$")) { - IndexedSeq("sei") ++ this.tokenizeItalianNumber( - word.substring(3).toLowerCase - ) - } else if (word.matches("^[Ss]ette(cen|mil)\\w+$")) { - IndexedSeq("sette") ++ this.tokenizeItalianNumber( - word.substring(5).toLowerCase - ) - } else if (word.matches("^[Oo]tto(cen|mil)\\w+$")) { - IndexedSeq("otto") ++ this.tokenizeItalianNumber( - word.substring(4).toLowerCase - ) - } else if (word.matches("^[Nn]ove(cen|mil)\\w+$")) { - IndexedSeq("nove") ++ this.tokenizeItalianNumber( - word.substring(4).toLowerCase - ) - } else if (word.matches("^[Cc]ento\\w+$")) { - IndexedSeq("cento") ++ this.tokenizeItalianNumber( - word.substring(5).toLowerCase - ) - } else if (word.matches("^[Mm]ille\\w+$")) { - IndexedSeq("mille") ++ this.tokenizeItalianNumber( - word.substring(5).toLowerCase - ) - } else if (word.matches("^[Mm]ila\\w+$")) { - IndexedSeq("mila") ++ this.tokenizeItalianNumber( - word.substring(4).toLowerCase - ) - } else if (word.matches("^[Vv]ent\\w+$")) { - if (word.matches("^[Vv]enti\\w*$")) { - IndexedSeq("venti") ++ this.tokenizeItalianNumber( - word.substring(5).toLowerCase - ) - } else if (word.matches("^[Vv]entennale$")) { - IndexedSeq("ventennale") - } else { - IndexedSeq("vent") ++ this.tokenizeItalianNumber( - word.substring(4).toLowerCase - ) - } - } else if (word.matches("^[Tt]rent\\w+$")) { - if (word.matches("^[Tt]renta\\w*$")) { - IndexedSeq("trenta") ++ this.tokenizeItalianNumber( - word.substring(6).toLowerCase - ) - } else { - IndexedSeq("trent") ++ this.tokenizeItalianNumber( - word.substring(5).toLowerCase - ) - } - } else if (word.matches("^[Qq]uarant\\w+$")) { - if (word.matches("^[Qq]uaranta\\w*$")) { - IndexedSeq("quaranta") ++ this.tokenizeItalianNumber( - word.substring(8).toLowerCase - ) - } else { - IndexedSeq("quarant") ++ this.tokenizeItalianNumber( - word.substring(7).toLowerCase - ) - } - } else if (word.matches("^[Cc]inquant\\w+$")) { - if (word.matches("^[Cc]inquanta\\w*$")) { - IndexedSeq("cinquanta") ++ this.tokenizeItalianNumber( - word.substring(9).toLowerCase - ) - } else { - IndexedSeq("cinquant") ++ this.tokenizeItalianNumber( - word.substring(8).toLowerCase - ) - } - } else if (word.matches("^[Ss]essant\\w+$")) { - if (word.matches("^[Ss]essanta\\w*$")) { - IndexedSeq("sessanta") ++ this.tokenizeItalianNumber( - word.substring(8).toLowerCase - ) - } else { - IndexedSeq("sessant") ++ this.tokenizeItalianNumber( - word.substring(7).toLowerCase - ) - } - } else if (word.matches("^[Ss]ettant\\w+$")) { - if (word.matches("^[Ss]ettanta\\w*$")) { - IndexedSeq("settanta") ++ this.tokenizeItalianNumber( - word.substring(8).toLowerCase - ) - } else { - IndexedSeq("settant") ++ this.tokenizeItalianNumber( - word.substring(7).toLowerCase - ) - } - } else if (word.matches("^[Oo]ttant\\w+$")) { - if (word.matches("^[Oo]ttanta\\w*$")) { - IndexedSeq("ottanta") ++ this.tokenizeItalianNumber( - word.substring(7).toLowerCase - ) - } else { - IndexedSeq("ottant") ++ this.tokenizeItalianNumber( - word.substring(6).toLowerCase - ) - } - } else if (word.matches("^[Nn]ovant\\w+$")) { - if (word.matches("^[Nn]ovanta\\w*$")) { - IndexedSeq("novanta") ++ this.tokenizeItalianNumber( - word.substring(7).toLowerCase - ) - } else { - IndexedSeq("novant") ++ this.tokenizeItalianNumber( - word.substring(6).toLowerCase - ) - } - } else if (word.matches("^[Dd]ecina$")) { - IndexedSeq("dieci", "na") - } else if (word.matches("^[Uu]ndicina$")) { - IndexedSeq("undici", "na") - } else if (word.matches("^[Dd]odicina$")) { - IndexedSeq("dodici", "na") - } else if (word.matches("^[Tt]redicina$")) { - IndexedSeq("tredici", "na") - } else if (word.matches("^[Qq]uattordicina$")) { - IndexedSeq("quattordici", "na") - } else if (word.matches("^[Qq]uindicina$")) { - IndexedSeq("quindici", "na") - } else if (word.matches("^[Ss]edicina$")) { - IndexedSeq("sedici", "na") - } else if (word.matches("^[Dd]icissettena$")) { - IndexedSeq("diciassette", "na") - } else if (word.matches("^[Dd]iciottona$")) { - IndexedSeq("diciotto", "na") - } else if (word.matches("^[Dd]iciannovena$")) { - IndexedSeq("diciannove", "na") - } else { - IndexedSeq(word) - } - } -} diff --git a/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/TemporalParse.scala b/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/TemporalParse.scala deleted file mode 100755 index 0126e87..0000000 --- a/timelines/tweaked-timenorm/src/main/scala/org/clulab/timenorm/scfg/TemporalParse.scala +++ /dev/null @@ -1,560 +0,0 @@ -package org.clulab.timenorm.scfg - -import java.time.temporal._ -import java.time.{LocalDateTime, ZoneId, ZonedDateTime} - -import org.clulab.time._ -import org.clulab.timenorm.scfg.PeriodSet.{Frequency, Quantifier} -import org.clulab.timenorm.scfg.SynchronousParser.Tree - -import scala.collection.immutable.Seq - - -trait TokenParser { - def toInt(token: String): Int - def toTemporalUnit(token: String): TemporalUnit - def toTemporalField(token: String): TemporalField -} - -class DefaultTokenParser extends TokenParser { - def toInt(token: String): Int = token.toInt - def toTemporalUnit(token: String): TemporalUnit = token match { - case "MORNINGS" => MORNINGS - case "AFTERNOONS" => AFTERNOONS - case "EVENINGS" => EVENINGS - case "NIGHTS" => NIGHTS - case "WEEKENDS" => WEEKENDS - case "SPRINGS" => SPRINGS - case "SUMMERS" => SUMMERS - case "FALLS" => FALLS - case "WINTERS" => WINTERS - case "QUARTER_YEARS" => IsoFields.QUARTER_YEARS - case "WEEK_BASED_YEARS" => IsoFields.WEEK_BASED_YEARS - case "UNSPECIFIED" => UNSPECIFIED - case _ => ChronoUnit.valueOf(token) - } - def toTemporalField(token: String): TemporalField = token match { - case "MORNING_OF_DAY" => MORNING_OF_DAY - case "AFTERNOON_OF_DAY" => AFTERNOON_OF_DAY - case "EVENING_OF_DAY" => EVENING_OF_DAY - case "NIGHT_OF_DAY" => NIGHT_OF_DAY - case "EASTER_DAY_OF_YEAR" => EASTER_DAY_OF_YEAR - case "DAY_OF_WEEKEND" => DAY_OF_WEEKEND - case "WEEKEND_OF_WEEK" => WEEKEND_OF_WEEK - case "DAY_OF_SPRING" => DAY_OF_SPRING - case "SPRING_OF_YEAR" => SPRING_OF_YEAR - case "DAY_OF_SUMMER" => DAY_OF_SUMMER - case "SUMMER_OF_YEAR" => SUMMER_OF_YEAR - case "DAY_OF_FALL" => DAY_OF_FALL - case "FALL_OF_YEAR" => FALL_OF_YEAR - case "DAY_OF_WINTER" => DAY_OF_WINTER - case "WINTER_OF_YEAR" => WINTER_OF_YEAR - case "YEAR_OF_DECADE" => YEAR_OF_DECADE - case "DECADE" => DECADE - case "DECADE_OF_CENTURY" => DECADE_OF_CENTURY - case "YEAR_OF_CENTURY" => YEAR_OF_CENTURY - case "CENTURY" => CENTURY - // the pattern matcher of 2.10.0 can't handle such big case statements, so break it up a bit - case token => token match { - case "DAY_OF_QUARTER" => IsoFields.DAY_OF_QUARTER - case "QUARTER_OF_YEAR" => IsoFields.QUARTER_OF_YEAR - case "WEEK_BASED_YEAR" => IsoFields.WEEK_BASED_YEAR - case "WEEK_OF_WEEK_BASED_YEAR" => IsoFields.WEEK_OF_WEEK_BASED_YEAR - case _ => ChronoField.valueOf(token) - } - } -} -object DefaultTokenParser extends DefaultTokenParser - -private[timenorm] abstract class CanFail(name: String) { - private[timenorm] def fail[T](tree: Tree): T = { - throw new UnsupportedOperationException( - "Don't know how to parse %s from %s".format(this.name, tree match { - case tree: Tree.Terminal => tree.token - case tree: Tree.NonTerminal => tree.rule.symbol + " -> " + tree.children.map { - case child: Tree.Terminal => child.token - case child: Tree.NonTerminal => child.rule.symbol - }.mkString(" ") - })) - } -} - -sealed abstract class TemporalParse - -object TemporalParse extends CanFail("[Temporal]") with (Tree => TemporalParse) { - - def apply(tree: Tree): TemporalParse = { - this.applyNoImplicit(tree, DefaultTokenParser) - } - - def apply(tree: Tree)(implicit tokenParser: TokenParser): TemporalParse = { - this.applyNoImplicit(tree, tokenParser) - } - - private def applyNoImplicit(tree: Tree, tokenParser: TokenParser): TemporalParse = { - implicit val parser = tokenParser - tree match { - case tree: Tree.NonTerminal => tree.rule.basicSymbol match { - case "[Period]" => PeriodParse(tree) - case "[PeriodSet]" => PeriodSetParse(tree) - case "[TimeSpan]" => TimeSpanParse(tree) - case "[TimeSpanSet]" => TimeSpanSetParse(tree) - case _ => fail(tree) - } - case _ => fail(tree) - } - } -} - -case class IntParse(value: Int) -object IntParse extends CanFail("[Int]") { - def apply(tree: Tree)(implicit tokenParser: TokenParser): IntParse = tree match { - case Tree.Terminal(number) => - IntParse(tokenParser.toInt(number)) - case tree => - val number = this.toDigits(tree).reverse.zipWithIndex.foldLeft(0){ - case (sum, (digit, index)) => sum + digit * math.pow(10, index).toInt - } - IntParse(number) - } - - private def toDigits(tree: Tree): List[Int] = tree match { - case Tree.Terminal(number) => - number.toInt :: Nil - case Tree.NonTerminal(rule, children) if rule.basicSymbol == "[Int]" => - children.flatMap(this.toDigits) - case _ => fail(tree) - } -} - -case class UnitParse(value: TemporalUnit) -object UnitParse extends CanFail("[Unit]") { - def apply(tree: Tree)(implicit tokenParser: TokenParser): UnitParse = tree match { - case Tree.Terminal(unit) => - UnitParse(tokenParser.toTemporalUnit(unit)) - case Tree.NonTerminal(rule, tree :: Nil) if rule.basicSymbol == "[Unit]" => - UnitParse(tree) - case _ => fail(tree) - } -} - -case class FieldValueParse(fieldValues: Map[TemporalField, Int]) { - for ((field, value) <- fieldValues; if !field.range().isValidValue(value)) - throw new UnsupportedOperationException("field %s cannot have value %s".format(field, value)) -} -object FieldValueParse extends CanFail("[FieldValue]") { - def apply(tree: Tree)(implicit tokenParser: TokenParser): FieldValueParse = tree match { - case tree: Tree.NonTerminal if tree.rule.basicSymbol == "[FieldValue]" => tree.children match { - case Tree.Terminal(field) :: number :: Nil => - FieldValueParse(Map(tokenParser.toTemporalField(field) -> IntParse(number).value)) - case children => - FieldValueParse(children.map(FieldValueParse.apply).map(_.fieldValues).flatten.toMap) - } - case _ => fail(tree) - } -} - -sealed abstract class PeriodParse extends TemporalParse { - def toPeriod: Period -} - -object PeriodParse extends CanFail("[Period]") { - - def apply(tree: Tree)(implicit tokenParser: TokenParser): PeriodParse = tree match { - case tree: Tree.Terminal => - Simple(1, UnitParse(tree).value) - case tree: Tree.NonTerminal if tree.rule.basicSymbol == "[Period]" => tree.children match { - case tree :: Nil => - PeriodParse(tree) - case Tree.Terminal("Simple") :: unit :: Nil => - Simple(1, UnitParse(unit).value) - case Tree.Terminal("Simple") :: amount :: unit :: Nil => - Simple(IntParse(amount).value, UnitParse(unit).value) - case Tree.Terminal("Unspecified") :: unit :: Nil => - Unspecified(UnitParse(unit).value) - case Tree.Terminal("Fractional") :: numerator :: denominator :: unit :: Nil => - Fractional(IntParse(numerator).value, IntParse(denominator).value, UnitParse(unit).value) - case Tree.Terminal("Fractional") :: whole :: numerator :: denominator :: unit :: Nil => - val denominatorValue = IntParse(denominator).value - Fractional(IntParse(whole).value * denominatorValue + IntParse(numerator).value, denominatorValue, UnitParse(unit).value) - case Tree.Terminal("Sum") :: children => - Sum(children.map(PeriodParse.apply)) - case Tree.Terminal("WithModifier") :: period :: Tree.Terminal(modifier) :: Nil => - WithModifier(PeriodParse(period), Modifier.valueOf(modifier)) - case _ => fail(tree) - } - case _ => fail(tree) - } - - case class Simple(amount: Int, unit: TemporalUnit) extends PeriodParse { - def toPeriod = Period(Map(unit -> amount), Modifier.Exact) - } - - case class Unspecified(unit: TemporalUnit) extends PeriodParse { - def toPeriod = Period(Map(unit -> Int.MaxValue), Modifier.Exact) - } - - case class Fractional(numerator: Int, denominator: Int, unit: TemporalUnit) extends PeriodParse { - def toPeriod = Period.fromFractional(numerator, denominator, unit, Modifier.Exact) - } - - case class Sum(periods: Seq[PeriodParse]) extends PeriodParse { - def toPeriod = periods.foldLeft(Period.empty)(_ + _.toPeriod) - } - - case class WithModifier(period: PeriodParse, modifier: Modifier) extends PeriodParse { - def toPeriod = period.toPeriod.copy(modifier = modifier) - } -} - -sealed abstract class PeriodSetParse extends TemporalParse { - def toPeriodSet: PeriodSet -} - -object PeriodSetParse extends CanFail("[PeriodSet]") { - - def apply(tree: Tree)(implicit tokenParser: TokenParser): PeriodSetParse = tree match { - case period: Tree.NonTerminal if period.rule.basicSymbol == "[Period]" => - Simple(PeriodParse(period)) - case tree: Tree.NonTerminal if tree.rule.basicSymbol == "[PeriodSet]" => tree.children match { - case tree :: Nil => - PeriodSetParse(tree) - case Tree.Terminal("Simple") :: period :: Nil => - Simple(PeriodParse(period)) - case Tree.Terminal("WithModifier") :: period :: Tree.Terminal(modifier) :: Nil => - WithModifier(PeriodSetParse(period), Modifier.valueOf(modifier)) - case Tree.Terminal("WithQuantifier") :: period :: Tree.Terminal(quantifier) :: Nil => - WithQuantifier(PeriodSetParse(period), Quantifier.valueOf(quantifier)) - case Tree.Terminal("WithFrequency") :: period :: times :: Nil => - WithFrequency(PeriodSetParse(period), Frequency(IntParse(times).value)) - case Tree.Terminal("WithFrequency") :: period :: times :: unit :: Nil => - WithFrequency(PeriodSetParse(period), Frequency(IntParse(times).value, Some(UnitParse(unit).value))) - case _ => fail(tree) - } - case _ => fail(tree) - } - - case class Simple(periodParse: PeriodParse) extends PeriodSetParse { - def toPeriodSet = PeriodSet(periodParse.toPeriod, Modifier.Exact) - } - - case class WithModifier(periodSet: PeriodSetParse, modifier: Modifier) extends PeriodSetParse { - def toPeriodSet = periodSet.toPeriodSet.copy(modifier = modifier) - } - - case class WithQuantifier(periodSet: PeriodSetParse, quantifier: Quantifier) extends PeriodSetParse { - def toPeriodSet = periodSet.toPeriodSet.copy(quantifier = quantifier) - } - - case class WithFrequency(periodSet: PeriodSetParse, frequency: Frequency) extends PeriodSetParse { - def toPeriodSet = periodSet.toPeriodSet.copy(frequency = frequency) - } -} - -sealed abstract class TimeSpanParse extends TemporalParse { - def toTimeSpan(anchor: TimeSpan): TimeSpan -} - -object TimeSpanParse extends CanFail("[TimeSpan]") { - - def apply(tree: Tree)(implicit tokenParser: TokenParser): TimeSpanParse = tree match { - case Tree.Terminal("PAST") => - Past - case Tree.Terminal("PRESENT") => - Present - case Tree.Terminal("FUTURE") => - Future - case tree: Tree.NonTerminal if tree.rule.basicSymbol == "[TimeSpan]" => tree.children match { - case tree :: Nil => - TimeSpanParse(tree) - case Tree.Terminal("Simple") :: (tree: Tree.Terminal) :: Nil => - TimeSpanParse(tree) - case Tree.Terminal("FindAbsolute") :: tree :: Nil => - FindAbsolute(FieldValueParse(tree).fieldValues) - case Tree.Terminal("FindEarlier") :: time :: fields :: Nil => - FindEarlier(TimeSpanParse(time), FieldValueParse(fields).fieldValues) - case Tree.Terminal("FindAtOrEarlier") :: time :: fields :: Nil => - FindAtOrEarlier(TimeSpanParse(time), FieldValueParse(fields).fieldValues) - case Tree.Terminal("FindLater") :: time :: fields :: Nil => - FindLater(TimeSpanParse(time), FieldValueParse(fields).fieldValues) - case Tree.Terminal("FindAtOrLater") :: time :: fields :: Nil => - FindAtOrLater(TimeSpanParse(time), FieldValueParse(fields).fieldValues) - case Tree.Terminal("FindEnclosing") :: time :: (periodTree: Tree.NonTerminal) :: Nil if periodTree.rule.basicSymbol == "[Period]" => - val unit = PeriodParse(periodTree).toPeriod.unitAmounts.keySet.maxBy(_.getDuration()) - FindEnclosing(TimeSpanParse(time), unit) - case Tree.Terminal("FindEnclosing") :: time :: (fieldTree: Tree.NonTerminal) :: Nil if fieldTree.rule.basicSymbol == "[FieldValue]" => - val unit = FieldValueParse(fieldTree).fieldValues.keySet.map(_.getRangeUnit()).maxBy(_.getDuration()) - FindEnclosing(TimeSpanParse(time), unit) - case Tree.Terminal("FindEnclosing") :: time :: unit :: Nil => - FindEnclosing(TimeSpanParse(time), UnitParse(unit).value) - case Tree.Terminal("FindEnclosed") :: time :: fields :: Nil => - FindEnclosed(TimeSpanParse(time), FieldValueParse(fields).fieldValues) - case Tree.Terminal("StartAtStartOf") :: time :: period :: Nil => - StartAtStartOf(TimeSpanParse(time), PeriodParse(period)) - case Tree.Terminal("StartAtEndOf") :: time :: period :: Nil => - StartAtEndOf(TimeSpanParse(time), PeriodParse(period)) - case Tree.Terminal("EndAtStartOf") :: time :: period :: Nil => - EndAtStartOf(TimeSpanParse(time), PeriodParse(period)) - case Tree.Terminal("MoveEarlier") :: time :: period :: Nil => - MoveEarlier(TimeSpanParse(time), PeriodParse(period)) - case Tree.Terminal("MoveLater") :: time :: period :: Nil => - MoveLater(TimeSpanParse(time), PeriodParse(period)) - case Tree.Terminal("WithModifier") :: time :: Tree.Terminal(modifier) :: Nil => - WithModifier(TimeSpanParse(time), Modifier.valueOf(modifier)) - case _ => fail(tree) - } - case _ => fail(tree) - } - - case object Past extends TimeSpanParse { - def toTimeSpan(anchor: TimeSpan) = { - new TimeSpan(TimeSpan.unspecifiedStart, anchor.start, Period.unspecified, Modifier.Approx) { - override def timeMLValueOption = Some("PAST_REF") - } - } - } - - case object Present extends TimeSpanParse { - def toTimeSpan(anchor: TimeSpan) = { - new TimeSpan(anchor.start, anchor.end, anchor.period, anchor.modifier) { - override def timeMLValueOption = Some("PRESENT_REF") - } - } - } - - case object Future extends TimeSpanParse { - def toTimeSpan(anchor: TimeSpan) = { - new TimeSpan(anchor.end, TimeSpan.unspecifiedEnd, Period.unspecified, Modifier.Approx) { - override def timeMLValueOption = Some("FUTURE_REF") - } - } - } - - abstract class FieldBasedTimeSpanParse(fields: Map[TemporalField, Int]) extends TimeSpanParse { - val minUnit = fields.keySet.map(_.getBaseUnit).minBy(_.getDuration) - } - - case class FindAbsolute(fields: Map[TemporalField, Int]) extends FieldBasedTimeSpanParse(fields) { - val fieldsLargeToSmall = fields.toSeq.sortBy{ - case (field, _) => field.getRangeUnit.getDuration - }.reverse - - def toTimeSpan: TimeSpan = { - val zero = ZonedDateTime.of(LocalDateTime.of(1, 1, 1, 0, 0), ZoneId.of("Z")) - val begin = this.fieldsLargeToSmall.foldLeft(zero) { - case (time, (field, value)) => time.`with`(field, value) - } - val period = Period(Map(this.minUnit -> 1), Modifier.Exact) - TimeSpan.startingAt(TimeSpan.truncate(begin, this.minUnit), period, Modifier.Exact) - } - def toTimeSpan(anchor: TimeSpan) = toTimeSpan - } - - abstract class DirectedFieldSearchingTimeSpanParse( - timeSpanParse: TimeSpanParse, - fields: Map[TemporalField, Int], - getStart: TimeSpan => ZonedDateTime, - step: (ZonedDateTime, TemporalUnit) => ZonedDateTime, - isAcceptable: (TimeSpan, TimeSpan) => Boolean) extends FieldBasedTimeSpanParse(fields) { - - val searchField = this.fields.keySet.minBy(_.getBaseUnit.getDuration) - val period = Period(Map(this.minUnit -> 1), Modifier.Exact) - - def toTimeSpan(anchor: TimeSpan) = { - val timeSpan = this.timeSpanParse.toTimeSpan(anchor) - - // search by base units for partial ranges (e.g. search by hours, not "mornings") - var searchUnit = this.searchField.getBaseUnit match { - case partialRange: PartialRange => partialRange.field.getBaseUnit - case unit => unit - } - - // if the field's range is fixed and the range unit is not estimated, - // then we can move by range units once we satisfy the base unit - var canSwitchToRange = this.searchField.range().isFixed() && - !this.searchField.getRangeUnit().isDurationEstimated() - - // one step at a time, search for a time that satisfies the field requirements - var start = getStart(timeSpan) - var result = this.tryToCreateTimeSpan(timeSpan, start) - while (result.isEmpty) { - start = step(start, searchUnit) - - // if we've satisfied the search field's base unit, start moving by range units - if (canSwitchToRange && start.get(searchField) == this.fields(searchField)) { - searchUnit = searchField.getRangeUnit() - canSwitchToRange = false - } - - // check if the current time satisfies the requirements - result = this.tryToCreateTimeSpan(timeSpan, start) - } - - // result must be present because the while loop exited - result.get - } - - private def tryToCreateTimeSpan(oldTimeSpan: TimeSpan, start: ZonedDateTime): Option[TimeSpan] = { - // must match all field values - if (this.fields.exists { case (field, value) => start.get(field) != value }) { - None - } - // must still match all field values after truncation - else { - val truncatedStart = TimeSpan.truncate(start, this.minUnit) - if (!fields.forall { case (field, value) => truncatedStart.get(field) == value }) { - None - } - // must satisfy any acceptance criteria - else { - val timeSpan = TimeSpan.startingAt(truncatedStart, this.period, Modifier.Exact) - if (!this.isAcceptable(oldTimeSpan, timeSpan)) None else Some(timeSpan) - } - } - } - } - - case class FindEarlier(timeSpanParse: TimeSpanParse, fields: Map[TemporalField, Int]) - extends DirectedFieldSearchingTimeSpanParse( - timeSpanParse, fields, _.end, _.minus(1, _), (oldSpan, newSpan) => - newSpan.start.isBefore(oldSpan.start) && newSpan.end.isBefore(oldSpan.end)) - - case class FindAtOrEarlier(timeSpanParse: TimeSpanParse, fields: Map[TemporalField, Int]) - extends DirectedFieldSearchingTimeSpanParse( - timeSpanParse, fields, _.end, _.minus(1, _), (oldSpan, newSpan) => - !newSpan.start.isAfter(oldSpan.start) || !newSpan.end.isAfter(oldSpan.end)) - - case class FindLater(timeSpanParse: TimeSpanParse, fields: Map[TemporalField, Int]) - extends DirectedFieldSearchingTimeSpanParse( - timeSpanParse, fields, _.start, _.plus(1, _), (oldSpan, newSpan) => - newSpan.start.isAfter(oldSpan.start) && newSpan.end.isAfter(oldSpan.end)) - - case class FindAtOrLater(timeSpanParse: TimeSpanParse, fields: Map[TemporalField, Int]) - extends DirectedFieldSearchingTimeSpanParse( - timeSpanParse, fields, _.start, _.plus(1, _), (oldSpan, newSpan) => - !newSpan.start.isBefore(oldSpan.start) || !newSpan.end.isBefore(oldSpan.end)) - - case class FindEnclosed(timeSpanParse: TimeSpanParse, fields: Map[TemporalField, Int]) - extends DirectedFieldSearchingTimeSpanParse( - timeSpanParse, fields, _.start, _.plus(1, _), (oldSpan, newSpan) => { - if (!newSpan.start.isBefore(oldSpan.end)) { - val message = "%s not found within %s".format(fields, timeSpanParse) - throw new UnsupportedOperationException(message) - } - !newSpan.start.isBefore(oldSpan.start) - }) - - case class FindEnclosing(timeSpanParse: TimeSpanParse, unit: TemporalUnit) extends TimeSpanParse { - def toTimeSpan(anchor: TimeSpan) = { - val timeSpan = timeSpanParse.toTimeSpan(anchor) - if (timeSpan.period > unit) { - throw new UnsupportedOperationException("%s is larger than 1 %s".format(timeSpanParse, unit)) - } - var start = TimeSpan.truncate(timeSpan.start, unit) - if (start.isAfter(timeSpan.start)) { - start = start.minus(1, unit) - } - val period = Period(Map(unit -> 1), Modifier.Exact) - TimeSpan.startingAt(start, period, timeSpan.modifier & period.modifier) - } - } - - abstract class MoveSpanParse(timeSpanParse: TimeSpanParse, periodParse: PeriodParse) - extends TimeSpanParse { - def toUnspecifiedTimeSpan(timeSpan: TimeSpan, period: Period, modifier: Modifier): TimeSpan - def toTimeSpan(timeSpan: TimeSpan, period: Period, modifier: Modifier): TimeSpan - def toTimeSpan(anchor: TimeSpan) = { - val timeSpan = timeSpanParse.toTimeSpan(anchor) - val period = periodParse.toPeriod - val modifier = timeSpan.modifier & period.modifier - val isUnspecified = period.unitAmounts.values.exists(_ == Int.MaxValue) - if (isUnspecified) { - this.toUnspecifiedTimeSpan(timeSpan, period, modifier & Modifier.Approx) - } else { - this.toTimeSpan(timeSpan, period, modifier) - } - } - } - - case class StartAtStartOf(timeSpanParse: TimeSpanParse, periodParse: PeriodParse) - extends MoveSpanParse(timeSpanParse, periodParse) { - def toUnspecifiedTimeSpan(timeSpan: TimeSpan, period: Period, modifier: Modifier) = { - TimeSpan(timeSpan.start, TimeSpan.unspecifiedEnd, period, modifier) - } - def toTimeSpan(timeSpan: TimeSpan, period: Period, modifier: Modifier) = { - TimeSpan.startingAt(timeSpan.start, period, modifier) - } - } - - case class StartAtEndOf(timeSpanParse: TimeSpanParse, periodParse: PeriodParse) - extends MoveSpanParse(timeSpanParse, periodParse) { - def toUnspecifiedTimeSpan(timeSpan: TimeSpan, period: Period, modifier: Modifier) = { - TimeSpan(timeSpan.end, TimeSpan.unspecifiedEnd, period, modifier) - } - def toTimeSpan(timeSpan: TimeSpan, period: Period, modifier: Modifier) = { - TimeSpan.startingAt(timeSpan.end, period, modifier) - } - } - - case class EndAtStartOf(timeSpanParse: TimeSpanParse, periodParse: PeriodParse) - extends MoveSpanParse(timeSpanParse, periodParse) { - def toUnspecifiedTimeSpan(timeSpan: TimeSpan, period: Period, modifier: Modifier) = { - TimeSpan(TimeSpan.unspecifiedStart, timeSpan.start, period, modifier) - } - def toTimeSpan(timeSpan: TimeSpan, period: Period, modifier: Modifier) = { - TimeSpan.endingAt(timeSpan.start, period, modifier) - } - } - - case class MoveEarlier(timeSpanParse: TimeSpanParse, periodParse: PeriodParse) - extends MoveSpanParse(timeSpanParse, periodParse) { - def toUnspecifiedTimeSpan(timeSpan: TimeSpan, period: Period, modifier: Modifier) = { - TimeSpan(TimeSpan.unspecifiedStart, timeSpan.end, period, modifier) - } - def toTimeSpan(timeSpan: TimeSpan, period: Period, modifier: Modifier) = { - val start = period.subtractFrom(timeSpan.start) - val end = period.subtractFrom(timeSpan.end) - TimeSpan(start, end, timeSpan.period, modifier) - } - } - - case class MoveLater(timeSpanParse: TimeSpanParse, periodParse: PeriodParse) - extends MoveSpanParse(timeSpanParse, periodParse) { - def toUnspecifiedTimeSpan(timeSpan: TimeSpan, period: Period, modifier: Modifier) = { - TimeSpan(timeSpan.start, TimeSpan.unspecifiedEnd, period, modifier) - } - def toTimeSpan(timeSpan: TimeSpan, period: Period, modifier: Modifier) = { - val start = period.addTo(timeSpan.start) - val end = period.addTo(timeSpan.end) - TimeSpan(start, end, timeSpan.period, modifier) - } - } - - case class WithModifier(timeSpan: TimeSpanParse, modifier: Modifier) extends TimeSpanParse { - def toTimeSpan(anchor: TimeSpan) = { - timeSpan.toTimeSpan(anchor).copy(modifier = modifier) - } - } -} - -sealed abstract class TimeSpanSetParse extends TemporalParse { - def toTimeSpanSet: TimeSpanSet -} - -object TimeSpanSetParse extends CanFail("[TimeSpanSet]") { - - def apply(tree: Tree)(implicit tokenParser: TokenParser): TimeSpanSetParse = tree match { - case tree: Tree.NonTerminal if tree.rule.basicSymbol == "[TimeSpanSet]" => tree.children match { - case tree :: Nil => - TimeSpanSetParse(tree) - case Tree.Terminal("Simple") :: tree :: Nil => - Simple(FieldValueParse(tree).fieldValues) - case _ => fail(tree) - } - case _ => fail(tree) - } - - case class Simple(fields: Map[TemporalField, Int]) extends TimeSpanSetParse { - def toTimeSpanSet = TimeSpanSet(fields) - } -}