input
stringlengths
10
828
output
stringlengths
5
107
private completion failure new completion failure class symbol c string localized if cache completion failure log warning proc messager log get localized string class file not found c flatname c debug print stack trace return new completion failure c localized else completion failure result cached completion failure result sym c result errmsg localized return result
static factory for completion failure objects
protected java file object preferred file object java file object a java file object b if prefer source return a get kind java file object kind source a b else long adate a get last modified long bdate b get last modified 6449326 policy for bad last modified time in class reader assert adate 0 bdate 0 return adate bdate a b
implement policy to choose to derive information from a source file or a
public byte buffer make byte buffer input stream in throws ioexception int limit in available if limit 1024 limit 1024 byte buffer result byte buffer cache get limit int position 0 while in available 0 if position limit expand buffer result byte buffer allocate limit 1 put byte buffer result flip int count in read result array position limit position if count 0 break result position position count return byte buffer result flip
make a byte buffer from an input stream
public jccompilation unit top level list jcannotation package annotations jcexpression pid list jctree defs assert package annotations null for jctree node defs assert node instanceof jcclass decl node instanceof jcimport node instanceof jcskip node instanceof jcerroneous node instanceof jcexpression statement jcexpression statement node expr instanceof jcerroneous node get class get simple name jccompilation unit tree new jccompilation unit package annotations pid defs null null null null tree pos pos return tree
create given tree node at current position
public jcexpression create symbol ctor list jcexpression args type t ctor owner erasure types jcnew class newclass new class null null type t args null newclass constructor ctor newclass set type t return newclass
create a method invocation from a method tree and a list of argument
public name param name int i return names from string x i
the name of synthetic parameter number i
public name typaram name int i return names from string a i
the name of synthetic type parameter number i
private type instantiate arg for all that type to list type tvars warner warn throws no instance exception list type targs try return instantiate expr that to warn catch no instance exception ex type to1 to for list type l tvars l non empty l l tail to1 types subst to1 list of l head list of syms unknown type return instantiate expr that to1 warn
try to instantiate argument type that to given type to
private void check within bounds list type tvars list type arguments warner warn throws no instance exception for list type tvs tvars args arguments tvs non empty tvs tvs tail args args tail if args head instanceof undet var continue list type bounds types subst types get bounds type var tvs head tvars arguments if types is subtype unchecked args head bounds warn throw unambiguous no instance exception set message inferred do not conform to bounds arguments tvars
check that type parameters are within their bounds
public void visit new class jcnew class tree class symbol c class symbol tree constructor owner add free vars c if null tree encl c has outer instance null outer this stack head visit symbol outer this stack head super visit new class tree
if tree refers to a class instance creation expression add all free
public void visit select jcfield access tree if tree name names this tree name names super tree selected type tsym clazz null outer this stack head visit symbol outer this stack head super visit select tree
if tree refers to a qualified this or super expression for anything
public void visit apply jcmethod invocation tree if tree info name tree meth names super add free vars class symbol tree info symbol tree meth owner symbol constructor tree info symbol tree meth class symbol c class symbol constructor owner if c has outer instance tree meth get tag jctree select null outer this stack head visit symbol outer this stack head super visit apply tree
if tree refers to a superclass constructor call add all free
private void enter synthetic diagnostic position pos symbol sym scope s if sym name names error sym name names empty for scope entry e s lookup sym name e scope s e e next if sym e sym sym kind e sym kind vm allows methods and variables with differing types if 0 sym kind mth var types erasure sym type equals types erasure e sym type continue duplicate error pos e sym break s enter sym
enter a synthetic symbol in a given scope but complain if there was
private symbol lookup synthetic name name scope s symbol sym s lookup name sym return null sym 0 sym flags synthetic null sym
look up a synthetic name in a given scope
private operator symbol binary access operator int acode for scope entry e syms predef class members elems null e e e sibling if e sym instanceof operator symbol operator symbol op operator symbol e sym if access code op opcode acode return op return null
return binary operator that corresponds to given access code
public boolean have grand include return gi file template name of list length 0
empty file name no grand include file
public boolean write dependencies on hfiles from gi return false
should c c source file be dependent on a file included
public iterator get macros return macros iterator
this returns an iterator of macros
public int default grand include threshold if system get property use precompiled header null return 30 else return 1 30
do not change this unless you fix things so precompiled
public boolean write dependencies on hfiles from gi return system get property use precompiled header null
should c c source file be dependent on a file included
public object require final object precond input throws contract error perform initial precondition test if precond input null throw new pre condition error if precond input instanceof boolean throw new pre condition error basic contract handler precondition input should have boolean type perform full precondition test final boolean has valid condition boolean precond input if has valid condition boolean value throw new pre condition error end of the if return contract true
require that the preconditions are met
public object ensure final object post condition input throws contract error if post condition input null throw new post condition error if post condition input instanceof boolean throw new pre condition error basic contract handler precondition input should have boolean type final boolean has valid condition boolean post condition input if has valid condition boolean value throw new post condition error return contract true
ensure that the postconditions are met
public int get count token list ngram integer count integer m ngrams get ngram if count null return 0 return count int value
retrives the count of the given ngram
public void set count token list ngram int count integer old count integer m ngrams put ngram new integer count if old count null m ngrams remove ngram throw new no such element exception
sets the count of an existing ngram
public void add token list ngram if contains ngram set count ngram get count ngram 1 else m ngrams put ngram new integer 1
adds one ngram if it already exists the count increase by one
public void add token list ngram int min length int max length for int length index min length length index max length 1 length index for int text index 0 text index length index 1 ngram size text index token grams new token length index for int i text index i text index length index i grams i text index ngram get token i add new token list grams
adds ngrams up to the specified length to the current instance
public void add string chars int min length int max length for int length index min length length index max length 1 length index for int text index 0 text index length index 1 chars length text index string gram chars substring text index text index length index to lower case add new token list new token token create gram
adds character ngrams to the current instance
public void remove token list tokens m ngrams remove tokens
removes the specified tokens form the ngram model they are just dropped
public boolean contains token list tokens return m ngrams contains key tokens
checks fit he given tokens are contained by the current instance
public int number of grams int counter 0 for iterator it iterator it has next token list ngram token list it next counter get count ngram return counter
retrives the total count of all ngrams
public void cutoff int cutoff under int cutoff over if cutoff under 0 cutoff over integer max value for iterator it iterator it has next token list ngram token list it next int count get count ngram if count cutoff under count cutoff over it remove
deletes all ngram which do appear less than the cutoff under value
public dictionary to dictionary boolean case sensitive dictionary dict new dictionary case sensitive for iterator it iterator it has next dict put token list it next return dict
creates a dictionary which contains all
public void serialize output stream out throws ioexception iterator entry iterator new iterator private iterator m dictionary iterator ngram model this iterator public boolean has next return m dictionary iterator has next public object next token list tokens token list m dictionary iterator next attributes attributes new attributes attributes set value count integer to string get count tokens return new entry tokens attributes public void remove throw new unsupported operation exception dictionary serializer serialize out entry iterator
writes the ngram instance to the given
public token get token int index return m tokens index
retrieves a token from the given index
public int size return m tokens length
retrieves the number of tokens inside this list
public boolean compare to ignore case token list tokens if size tokens size for int i 0 i size i if get token i get token compare to ignore case tokens get token i get token 0 return false else return false return true
compares to tokens list and ignores the case of the tokens
public string to string return m token
represents the token as human readable string
public sdevent stream data stream d end of sentence scanner s this d s new default sdcontext generator s get end of sentence characters
class constructor which uses the end of sentence scanner to locate
public void add events span tokens string text event tevents create events tokens text this skip alpha numerics cg events add all java util arrays as list tevents
adds training events to the event stream for each of the specified tokens
public void set alpha numeric optimization boolean opt alpha numeric optimization opt
used to have the tokenizer ignore tokens which only contain alpha numeric characters
public boolean use alpha numeric optimization return alpha numeric optimization
returns the value of the alpha numeric optimization flag
public set get synsets return synsets
returns the set of synsets associated with this entity
public discourse entity get entity int i return discourse entity entities get i
returns the entity at the specified index
public void merge entities discourse entity e1 discourse entity e2 float confidence for iterator ei e2 get mentions ei has next e1 add mention mention context ei next system err println discourse model merge entities removing e2 entities remove e2
merges the specified entities into a single entity with the specified confidence
private set construct head set list mentions set head set new hash set for iterator ei mentions iterator ei has next context ec context ei next head set add ec get head token text to lower case return head set
produces a set of head words for the specified list of mentions
private map construct head sets hash list entities map head sets new hash map for iterator ei entities key set iterator ei has next integer key integer ei next list entity contexts list entities get key head sets put key construct head set entity contexts return head sets
constructs a mapping between the specified entities and their head set
private set construct name set list mentions set name set new hash set for iterator ei mentions iterator ei has next context ec context ei next if ec get name type null name set add ec get name type return name set
produces the set of name types associated with each of the specified mentions
public void train model throws ioexception if debug on file writer writer new file writer model name events for iterator ei events iterator ei has next event e event ei next writer write e to string n writer close new suffix sensitive gismodel writer gis train model new collection event stream events 100 10 new file model name model extension persist
train a model based on the previously supplied evidence
protected boolean definite article string tok string tag tok tok to lower case if tok equals the tok equals these tok equals these tag equals prp return true return false
returns whether the specified token is a definite article
protected map construct head map list nps map head map new hash map for int ni 0 ni nps size ni parse np parse nps get ni gather heads np head map return head map
assigns head realtions between noun phrases and the child np
public sequence best sequence list sequence object additional context return best sequences 1 sequence to array additional context 0
returns the best sequence of outcomes based on model for this object
public sequence best sequence object sequence object additional context return best sequences 1 sequence additional context zero log 0
returns the best sequence of outcomes based on model for this object
protected boolean valid sequence int i object input sequence string outcomes sequence string outcome return true
determines whether a particular continuation of a sequence is valid
public void add string outcome double p outcomes add outcome probs add new double p score math log p
adds an outcome and probability to this sequence
public list get outcomes return outcomes
returns a list of outcomes for this sequence
public void get probs double ps for int pi 0 pl probs size pi pl pi ps pi double probs get pi double value
populates an array with the probabilities associated with the outcomes of this sequece
public void add object data check iterating m data add data
adds the given data object
public void add object data check iterating m data add all arrays as list data
adds the given array of data
public void add collection data check iterating m data add all data
adds the given collection of data
public string get covered text string text if get end text length throw new illegal argument exception the span to string is outside the given text return text substring get start get end
retrieves the string covered by the current span of the specified text
public object next token m is iterating true if m data iterator null m data iterator m data iterator return m data iterator next
retrives the next token
public boolean has next m is iterating true if m data iterator null m data iterator m data iterator return m data iterator has next
checks if one more token is available
public int compare to object o span s span o if get start s get start return 1 else if get start s get start if get end s get end return 1 else if get end s get end return 1 else return 0 else return 1
compares the specified span to the current span
public void subtract object o integer count integer cset get o if count null int c count int value 1 if c 0 cset remove o else cset put o integer value of c
reduces the count associated with this object by 1
public boolean equals object o boolean result if o this result true else if o instanceof span span s span o result get start s get start get end s get end else result false return result
checks if the specified span is equal to the current span
public void set count object o int c cset put o integer value of c
assigns the specified object the specified count in the set
public int get count object o integer count integer cset get o if count null return 0 else return count int value
return the count of the specified object
public void subtract object o int count int cset get o if count null count 0 if count 0 0 cset remove o
reduces the count associated with this object by 1
public void set count object o int c int nums int cset get o if nums null nums 0 c else cset put o new int c 1
assigns the specified object the specified count in the set
public int get count object o int nums int cset get o if nums null return 0 else return nums 0
return the count of the specified object
public boolean contains token token return tokens contains token
checks if at leat one
public iterator iterator return m name value map key set iterator
iterates over the keys
protected boolean valid outcome string outcome string sequence return true
this method determines wheter the outcome is valid for the preceeding sequence
public void put token list tokens if case sensitive m entry set add tokens else m entry set add new ignore case token list tokens
adds the tokens to the dictionary as one new entry
public boolean contains token list tokens if case sensitive return m entry set contains tokens else return m entry set contains new ignore case token list tokens
checks if this dictionary has the given entry
public void remove token list tokens if case sensitive m entry set remove tokens else m entry set remove new ignore case token list tokens
removes the given tokens form the current instance
public int size return m entry set size
retrieves the number of tokens in the current instance
public void serialize output stream out throws ioexception iterator entry iterator new iterator private iterator m dictionary iterator dictionary this iterator public boolean has next return m dictionary iterator has next public object next token list tokens token list m dictionary iterator next return new entry tokens new attributes public void remove throw new unsupported operation exception dictionary serializer serialize out entry iterator
writes the current instance to the given
public parse clone parse node if this node return parse this clone else parse c parse this clone parse lc parse c parts get parts size 1 c parts set parts size 1 lc clone node return c
clones the right frontier of parse up to the specified node
private map get non adjoined parent parse node map parents new hash map parse parent node get parent int index index of node parent parents put parent new integer index while parent get type equals node get type node parent parent parent get parent index index of node parent parents put parent new integer index return parents
returns a set of parent nodes which consist of the immediate
protected string production parse p boolean include punctuation string buffer production new string buffer 20 production append p get type append parse children abstract bottom up parser collapse punctuation p get children punct set for int ci 0 ci children length ci production append children ci get type if ci 1 children length production append collection next punct children ci get next punctuation set if include punctuation next punct null for iterator pit next punct iterator pit has next parse punct parse pit next production append punct get type append return production to string
generates a string representing the grammar rule production that the specified parse
public collection get previous punctuation set return prev punct set
returns the set of punctuation parses that occur immediately before this parse
public void add previous punctuation parse punct if this prev punct set null this prev punct set new tree set prev punct set add punct
designates that the specifed punctuation should is prior to this parse
public void test token table garbage collection token token token create test weak reference weak token new weak reference token token null system gc assert true weak token get null
tests if the
public void test token table lookup token token1 token create test token token2 token create test assert true token1 token2
tests if the
protected void checkcons parse child string i string type list features string buffer feat new string buffer 20 feat append c append i append append child get type append append child get head to string append append type features add feat to string feat set length 0 feat append c append i append append child get type append append type features add feat to string
produces features to determine whether the specified child node is part of
public collection get next punctuation set return next punct set
returns the set of punctuation parses that occur immediately after this parse
public void test without window adaptive feature generator window feature generator new window feature generator new identity feature generator 0 0 int test token index 2 window feature generator create features features test sentence test token index null assert assert equals 1 features size assert assert equals features get 0 test sentence test token index
tests if the
protected void get frontier nodes list rf parse nodes int left index 0 int prev head index 1 for int fi 0 fi rf size fi parse fn parse rf get fi int head index fn get head index if head index prev head index nodes left index fn left index prev head index head index if left index nodes length break for int ni left index ni nodes length ni nodes ni null
populates specified nodes array with left most right frontier
public void add next punctuation parse punct if this next punct set null this next punct set new tree set next punct set add punct
designates that the specifed punctuation follows this parse
public void test lookup token list entry1 token create new string 1a 1b token list entry2 token create new string 1 a 1 c dictionary dict new dictionary dict put entry1 assert true dict contains entry1 assert true dict contains entry2
tests a basic lookup
public void test whitespace tokenization string text a b c d e f string tokenized text m tokenizer tokenize text assert true a equals tokenized text 0 assert true b equals tokenized text 1 assert true c equals tokenized text 2 assert true d equals tokenized text 3 assert true e equals tokenized text 4 assert true f equals tokenized text 5 assert true tokenized text length 6
tests if it can tokenize whitespace seperated tokens
public void test serialization throws ioexception invalid format exception dictionary reference new dictionary token a1 token create a1 token a2 token create a2 token a3 token create a3 token a5 token create a5 reference put new token list new token a1 a2 a3 a5 byte array output stream out new byte array output stream reference serialize out dictionary recreated new dictionary new byte array input stream out to byte array assert true reference equals recreated
tests serialization and deserailization of the
public void test word dot tokenization string text a string tokenized text m tokenizer tokenize text assert true a equals tokenized text 0 assert true equals tokenized text 1 assert true tokenized text length 2
tests if it can tokenize a word and a dot
public void test word numeric tokeniztation string text 305 kw string tokenized text m tokenizer tokenize text assert true 305 equals tokenized text 0 assert true kw equals tokenized text 1 assert true tokenized text length 2
tests if it can tokenize a word and numeric
public void test parse one entry per line throws ioexception string test dictionary 1a 1b 1c 1d n 2a 2b 2c n 3a n 4a 4b dictionary dictionay dictionary parse one entry per line new string reader test dictionary assert true dictionay size 4 assert true dictionay contains token create new string 1a 1b 1c 1d assert true dictionay contains token create new string 2a 2b 2c assert true dictionay contains token create new string 3a assert true dictionay contains token create new string 4a 4b
tests for the
public void test equals token list entry1 token create new string 1a 1b token list entry2 token create new string 2a 2b dictionary dict a new dictionary dict a put entry1 dict a put entry2 dictionary dict b new dictionary dict b put entry1 dict b put entry2 assert true dict a equals dict b
tests for the
public void test to string token list entry1 token create new string 1a 1b dictionary dict a new dictionary dict a to string dict a put entry1 dict a to string
tests for the
public void test different case lookup token list entry1 token create new string 1a 1b token list entry2 token create new string 1 a 1 b dictionary dict new dictionary dict put entry1 assert true dict contains entry2
tests the lookup of tokens of different case
public void set next punctuation collection punct set this next punct set punct set
sets the set of punctuation tags which follow this parse