Skip to content

Instantly share code, notes, and snippets.

@schmmd
Created January 24, 2014 19:56
Show Gist options
  • Save schmmd/8604994 to your computer and use it in GitHub Desktop.
Save schmmd/8604994 to your computer and use it in GitHub Desktop.
And := PatternTagger {
<string=/and|that|which/>
}
Help := PatternTagger {
<string=/(help|aid|allow|assist|enable)(s)?/>
}
EffectRel := TypePatternTagger {
// in order for
(?:<string="in"> <string="order"> <string=/for|that/> )
// which helps with
| (?:<string=/and|that|which|to/>? @Help <string=/with|in/> )
// which results in
| (?:@And? <string="results"> <string="in"> )
// so that
| (?:<string="so"> <string="that"> )
// and by doing so
| (?:<string="and"> <string="by"> <string="doing"> <string="so"> )
// may be one way that
| (?:<pos="MD">? <string=/be|is|are/> <pos="DT" | pos="CD">? <string=/way(s)?/> <string="that"> )
// which is why
| (?:<string=/and|which/>? <pos="MD">? <string=/be|is|are/> <string="why"> )
}
EffectRelTo := TypePatternTagger {
// in order to
(?:<string="in"> <string="order"> <string="to"> )
// which helps to
| (?:<string=/and|that|which|to/>? @Help <string="to"> )
// may be one way to
| (?:<pos="MD">? <string=/be|is|are/> <pos="DT" | pos="CD">? <string=/way(s)?/> <string="to"> )
}
CauseRel := TypePatternTagger {
// may be because of
(?:(?:<pos="MD">? <string=/be|is|are/>)? <string="because"> <string="of">? )
// may be caused by
| (?:<pos="MD">? <string=/be|is|are/> <string="caused"> <string="by"> )
// which causes
| (?:@And? <string=/cause(s)?/> )
}
FunctionRel := TypePatternTagger {
// which may be responsible for
(?:@And? <pos="MD">? <string=/be|is|are/> <string=/used|responsible/> <string="for"> )
}
FunctionRelTo := TypePatternTagger {
// which may be used to
(?:@And? <pos="MD">? <string=/be|is|are/> <string="used"> <string="to"> )
}
ExampleRel := TypePatternTagger {
// which may include
(?:@And? <pos="MD">? <string=/include(s)?/> )
// such as
| (?:<string="such"> <string="as"> )
// is an example of
| (?:@And? <pos="MD">? <string=/be|is|are/> <pos="DT"> <string=/example(s)?/> <string="of"> )
}
Rel := TypePatternTagger {
(?:@EffectRel | @CauseRel | @FunctionRel | @ExampleRel)
}
RelTo := TypePatternTagger {
(?:@EffectRelTo | @FunctionRelTo)
}
>>>
Name := RedefineTagger(Name)
Rel := RedefineTagger(Rel)
RelTo := RedefineTagger(RelTo)
NG := PatternTagger {
<chunk='B-NP'> <chunk='I-NP'>* (?:<string="of"> <chunk='B-NP'> <chunk='I-NP'>*)?
}
>>>
Name := RedefineTagger(Name)
NG := RedefineTagger(NG)
PP := RedefineTagger(PP)
Rel := RedefineTagger(Rel)
RelTo := RedefineTagger(RelTo)
Modal := PatternTagger {
<pos="MD"> <pos="RB">?
}
Aux := PatternTagger {
<string=/be|am|is|are|have|has/> <pos="RB">? <string="been">?
}
VG := TypePatternTagger {
(?:@Modal)? (?:@Aux)? (<Head>:<pos=/VB[DPZGN]?/> <pos=/R[PB]/ | pos="IN">?)
}
>>>
Name := RedefineTagger(Name)
NG := RedefineTagger(NG)
PP := RedefineTagger(PP)
Rel := RedefineTagger(Rel)
RelTo := RedefineTagger(RelTo)
Modal := PatternTagger {
<pos="MD"> <pos="RB">?
}
Aux := PatternTagger {
<string=/be|am|is|are|have|has/> <pos="RB">? <string="been">?
}
VG := TypePatternTagger {
(?:@Modal)? (?:@Aux)? (<Head>:<pos=/VB[DPZGN]?/> <pos=/R[PB]/ | pos="IN">?)
}
>>>
Name := RedefineTagger(Name)
NG := RedefineTagger(NG)
PP := RedefineTagger(PP)
Rel := RedefineTagger(Rel)
RelTo := RedefineTagger(RelTo)
Modal := PatternTagger {
<pos="MD"> <pos="RB">?
}
Aux := PatternTagger {
<string=/be|am|is|are|have|has/> <pos="RB">? <string="been">?
}
VG := TypePatternTagger {
(?:@Modal)? (?:@Aux)? (<Head>:<pos=/VB[DPZGN]?/> <pos=/R[PB]/ | pos="IN">?)
}
>>>
Name := RedefineTagger(Name)
NG := RedefineTagger(NG)
PP := RedefineTagger(PP)
Rel := RedefineTagger(Rel)
RelTo := RedefineTagger(RelTo)
Modal := PatternTagger {
<pos="MD"> <pos="RB">?
}
Aux := PatternTagger {
<string=/be|am|is|are|have|has/> <pos="RB">? <string="been">?
}
VG := TypePatternTagger {
(?:@Modal)? (?:@Aux)? (<Head>:<pos=/VB[DPZGN]?/> <pos=/R[PB]/ | pos="IN">?)
}
@schmmd
Copy link
Author

schmmd commented Jan 24, 2014

Some good examples:

erosion is one way that soil can move
a lens is used to see small objects
animals eat food in order to get nutrients

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment