_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q10900
route6.update
train
public static base_responses update(nitro_service client, route6 resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { route6 updateresources[] = new route6[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new route6(); updateresources[i].network = resources[i].network; updateresources[i].gateway = resources[i].gateway; updateresources[i].vlan = resources[i].vlan; updateresources[i].weight = resources[i].weight; updateresources[i].distance = resources[i].distance; updateresources[i].cost = resources[i].cost; updateresources[i].advertise = resources[i].advertise; updateresources[i].msr = resources[i].msr; updateresources[i].monitor = resources[i].monitor; updateresources[i].td = resources[i].td; } result = update_bulk_request(client, updateresources); } return result; }
java
{ "resource": "" }
q10901
route6.get
train
public static route6[] get(nitro_service service) throws Exception{ route6 obj = new route6(); route6[] response = (route6[])obj.get_resources(service); return response; }
java
{ "resource": "" }
q10902
route6.get
train
public static route6[] get(nitro_service service, route6_args args) throws Exception{ route6 obj = new route6(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); route6[] response = (route6[])obj.get_resources(service, option); return response; }
java
{ "resource": "" }
q10903
auditsyslogpolicy_vpnglobal_binding.get
train
public static auditsyslogpolicy_vpnglobal_binding[] get(nitro_service service, String name) throws Exception{ auditsyslogpolicy_vpnglobal_binding obj = new auditsyslogpolicy_vpnglobal_binding(); obj.set_name(name); auditsyslogpolicy_vpnglobal_binding response[] = (auditsyslogpolicy_vpnglobal_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q10904
MtasCQLParserBasicSentenceCondition.addWord
train
public void addWord(MtasCQLParserWordFullCondition w) throws ParseException { assert w.getCondition() .not() == false : "condition word should be positive in sentence definition"; if (!simplified) { partList.add(w); } else { throw new ParseException("already simplified"); } }
java
{ "resource": "" }
q10905
MtasCQLParserBasicSentenceCondition.addBasicSentence
train
public void addBasicSentence(MtasCQLParserBasicSentenceCondition s) throws ParseException { if (!simplified) { List<MtasCQLParserBasicSentencePartCondition> newWordList = s .getPartList(); partList.addAll(newWordList); } else { throw new ParseException("already simplified"); } }
java
{ "resource": "" }
q10906
MtasCQLParserBasicSentenceCondition.setOccurence
train
public void setOccurence(int min, int max) throws ParseException { if (!simplified) { if ((min < 0) || (min > max) || (max < 1)) { throw new ParseException("Illegal number {" + min + "," + max + "}"); } if (min == 0) { optional = true; } minimumOccurence = Math.max(1, min); maximumOccurence = max; } else { throw new ParseException("already simplified"); } }
java
{ "resource": "" }
q10907
nspbr6.add
train
public static base_response add(nitro_service client, nspbr6 resource) throws Exception { nspbr6 addresource = new nspbr6(); addresource.name = resource.name; addresource.td = resource.td; addresource.action = resource.action; addresource.srcipv6 = resource.srcipv6; addresource.srcipop = resource.srcipop; addresource.srcipv6val = resource.srcipv6val; addresource.srcport = resource.srcport; addresource.srcportop = resource.srcportop; addresource.srcportval = resource.srcportval; addresource.destipv6 = resource.destipv6; addresource.destipop = resource.destipop; addresource.destipv6val = resource.destipv6val; addresource.destport = resource.destport; addresource.destportop = resource.destportop; addresource.destportval = resource.destportval; addresource.srcmac = resource.srcmac; addresource.protocol = resource.protocol; addresource.protocolnumber = resource.protocolnumber; addresource.vlan = resource.vlan; addresource.Interface = resource.Interface; addresource.priority = resource.priority; addresource.state = resource.state; addresource.msr = resource.msr; addresource.monitor = resource.monitor; addresource.nexthop = resource.nexthop; addresource.nexthopval = resource.nexthopval; addresource.nexthopvlan = resource.nexthopvlan; return addresource.add_resource(client); }
java
{ "resource": "" }
q10908
nspbr6.add
train
public static base_responses add(nitro_service client, nspbr6 resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nspbr6 addresources[] = new nspbr6[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new nspbr6(); addresources[i].name = resources[i].name; addresources[i].td = resources[i].td; addresources[i].action = resources[i].action; addresources[i].srcipv6 = resources[i].srcipv6; addresources[i].srcipop = resources[i].srcipop; addresources[i].srcipv6val = resources[i].srcipv6val; addresources[i].srcport = resources[i].srcport; addresources[i].srcportop = resources[i].srcportop; addresources[i].srcportval = resources[i].srcportval; addresources[i].destipv6 = resources[i].destipv6; addresources[i].destipop = resources[i].destipop; addresources[i].destipv6val = resources[i].destipv6val; addresources[i].destport = resources[i].destport; addresources[i].destportop = resources[i].destportop; addresources[i].destportval = resources[i].destportval; addresources[i].srcmac = resources[i].srcmac; addresources[i].protocol = resources[i].protocol; addresources[i].protocolnumber = resources[i].protocolnumber; addresources[i].vlan = resources[i].vlan; addresources[i].Interface = resources[i].Interface; addresources[i].priority = resources[i].priority; addresources[i].state = resources[i].state; addresources[i].msr = resources[i].msr; addresources[i].monitor = resources[i].monitor; addresources[i].nexthop = resources[i].nexthop; addresources[i].nexthopval = resources[i].nexthopval; addresources[i].nexthopvlan = resources[i].nexthopvlan; } result = add_bulk_request(client, addresources); } return result; }
java
{ "resource": "" }
q10909
nspbr6.renumber
train
public static base_response renumber(nitro_service client) throws Exception { nspbr6 renumberresource = new nspbr6(); return renumberresource.perform_operation(client,"renumber"); }
java
{ "resource": "" }
q10910
nspbr6.renumber
train
public static base_responses renumber(nitro_service client, nspbr6 resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nspbr6 renumberresources[] = new nspbr6[resources.length]; for (int i=0;i<resources.length;i++){ renumberresources[i] = new nspbr6(); } result = perform_operation_bulk_request(client, renumberresources,"renumber"); } return result; }
java
{ "resource": "" }
q10911
nspbr6.update
train
public static base_response update(nitro_service client, nspbr6 resource) throws Exception { nspbr6 updateresource = new nspbr6(); updateresource.name = resource.name; updateresource.action = resource.action; updateresource.srcipv6 = resource.srcipv6; updateresource.srcipop = resource.srcipop; updateresource.srcipv6val = resource.srcipv6val; updateresource.srcport = resource.srcport; updateresource.srcportop = resource.srcportop; updateresource.srcportval = resource.srcportval; updateresource.destipv6 = resource.destipv6; updateresource.destipop = resource.destipop; updateresource.destipv6val = resource.destipv6val; updateresource.destport = resource.destport; updateresource.destportop = resource.destportop; updateresource.destportval = resource.destportval; updateresource.srcmac = resource.srcmac; updateresource.protocol = resource.protocol; updateresource.protocolnumber = resource.protocolnumber; updateresource.vlan = resource.vlan; updateresource.Interface = resource.Interface; updateresource.priority = resource.priority; updateresource.msr = resource.msr; updateresource.monitor = resource.monitor; updateresource.nexthop = resource.nexthop; updateresource.nexthopval = resource.nexthopval; updateresource.nexthopvlan = resource.nexthopvlan; return updateresource.update_resource(client); }
java
{ "resource": "" }
q10912
nspbr6.update
train
public static base_responses update(nitro_service client, nspbr6 resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nspbr6 updateresources[] = new nspbr6[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new nspbr6(); updateresources[i].name = resources[i].name; updateresources[i].action = resources[i].action; updateresources[i].srcipv6 = resources[i].srcipv6; updateresources[i].srcipop = resources[i].srcipop; updateresources[i].srcipv6val = resources[i].srcipv6val; updateresources[i].srcport = resources[i].srcport; updateresources[i].srcportop = resources[i].srcportop; updateresources[i].srcportval = resources[i].srcportval; updateresources[i].destipv6 = resources[i].destipv6; updateresources[i].destipop = resources[i].destipop; updateresources[i].destipv6val = resources[i].destipv6val; updateresources[i].destport = resources[i].destport; updateresources[i].destportop = resources[i].destportop; updateresources[i].destportval = resources[i].destportval; updateresources[i].srcmac = resources[i].srcmac; updateresources[i].protocol = resources[i].protocol; updateresources[i].protocolnumber = resources[i].protocolnumber; updateresources[i].vlan = resources[i].vlan; updateresources[i].Interface = resources[i].Interface; updateresources[i].priority = resources[i].priority; updateresources[i].msr = resources[i].msr; updateresources[i].monitor = resources[i].monitor; updateresources[i].nexthop = resources[i].nexthop; updateresources[i].nexthopval = resources[i].nexthopval; updateresources[i].nexthopvlan = resources[i].nexthopvlan; } result = update_bulk_request(client, updateresources); } return result; }
java
{ "resource": "" }
q10913
nspbr6.clear
train
public static base_response clear(nitro_service client) throws Exception { nspbr6 clearresource = new nspbr6(); return clearresource.perform_operation(client,"clear"); }
java
{ "resource": "" }
q10914
nspbr6.apply
train
public static base_response apply(nitro_service client) throws Exception { nspbr6 applyresource = new nspbr6(); return applyresource.perform_operation(client,"apply"); }
java
{ "resource": "" }
q10915
nspbr6.apply
train
public static base_responses apply(nitro_service client, nspbr6 resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nspbr6 applyresources[] = new nspbr6[resources.length]; for (int i=0;i<resources.length;i++){ applyresources[i] = new nspbr6(); } result = perform_operation_bulk_request(client, applyresources,"apply"); } return result; }
java
{ "resource": "" }
q10916
nspbr6.get
train
public static nspbr6[] get(nitro_service service) throws Exception{ nspbr6 obj = new nspbr6(); nspbr6[] response = (nspbr6[])obj.get_resources(service); return response; }
java
{ "resource": "" }
q10917
nspbr6.get
train
public static nspbr6[] get(nitro_service service, nspbr6_args args) throws Exception{ nspbr6 obj = new nspbr6(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); nspbr6[] response = (nspbr6[])obj.get_resources(service, option); return response; }
java
{ "resource": "" }
q10918
nspbr6.get
train
public static nspbr6 get(nitro_service service, String name) throws Exception{ nspbr6 obj = new nspbr6(); obj.set_name(name); nspbr6 response = (nspbr6) obj.get_resource(service); return response; }
java
{ "resource": "" }
q10919
spilloverpolicy_stats.get
train
public static spilloverpolicy_stats[] get(nitro_service service) throws Exception{ spilloverpolicy_stats obj = new spilloverpolicy_stats(); spilloverpolicy_stats[] response = (spilloverpolicy_stats[])obj.stat_resources(service); return response; }
java
{ "resource": "" }
q10920
spilloverpolicy_stats.get
train
public static spilloverpolicy_stats get(nitro_service service, String name) throws Exception{ spilloverpolicy_stats obj = new spilloverpolicy_stats(); obj.set_name(name); spilloverpolicy_stats response = (spilloverpolicy_stats) obj.stat_resource(service); return response; }
java
{ "resource": "" }
q10921
appfwprofile_xmlvalidationurl_binding.get
train
public static appfwprofile_xmlvalidationurl_binding[] get(nitro_service service, String name) throws Exception{ appfwprofile_xmlvalidationurl_binding obj = new appfwprofile_xmlvalidationurl_binding(); obj.set_name(name); appfwprofile_xmlvalidationurl_binding response[] = (appfwprofile_xmlvalidationurl_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q10922
vpnvserver_responderpolicy_binding.get
train
public static vpnvserver_responderpolicy_binding[] get(nitro_service service, String name) throws Exception{ vpnvserver_responderpolicy_binding obj = new vpnvserver_responderpolicy_binding(); obj.set_name(name); vpnvserver_responderpolicy_binding response[] = (vpnvserver_responderpolicy_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q10923
responderpolicy.add
train
public static base_response add(nitro_service client, responderpolicy resource) throws Exception { responderpolicy addresource = new responderpolicy(); addresource.name = resource.name; addresource.rule = resource.rule; addresource.action = resource.action; addresource.undefaction = resource.undefaction; addresource.comment = resource.comment; addresource.logaction = resource.logaction; addresource.appflowaction = resource.appflowaction; return addresource.add_resource(client); }
java
{ "resource": "" }
q10924
responderpolicy.update
train
public static base_response update(nitro_service client, responderpolicy resource) throws Exception { responderpolicy updateresource = new responderpolicy(); updateresource.name = resource.name; updateresource.rule = resource.rule; updateresource.action = resource.action; updateresource.undefaction = resource.undefaction; updateresource.comment = resource.comment; updateresource.logaction = resource.logaction; updateresource.appflowaction = resource.appflowaction; return updateresource.update_resource(client); }
java
{ "resource": "" }
q10925
responderpolicy.update
train
public static base_responses update(nitro_service client, responderpolicy resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { responderpolicy updateresources[] = new responderpolicy[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new responderpolicy(); updateresources[i].name = resources[i].name; updateresources[i].rule = resources[i].rule; updateresources[i].action = resources[i].action; updateresources[i].undefaction = resources[i].undefaction; updateresources[i].comment = resources[i].comment; updateresources[i].logaction = resources[i].logaction; updateresources[i].appflowaction = resources[i].appflowaction; } result = update_bulk_request(client, updateresources); } return result; }
java
{ "resource": "" }
q10926
responderpolicy.unset
train
public static base_response unset(nitro_service client, responderpolicy resource, String[] args) throws Exception{ responderpolicy unsetresource = new responderpolicy(); unsetresource.name = resource.name; return unsetresource.unset_resource(client,args); }
java
{ "resource": "" }
q10927
responderpolicy.rename
train
public static base_response rename(nitro_service client, responderpolicy resource, String new_name) throws Exception { responderpolicy renameresource = new responderpolicy(); renameresource.name = resource.name; return renameresource.rename_resource(client,new_name); }
java
{ "resource": "" }
q10928
responderpolicy.get
train
public static responderpolicy[] get(nitro_service service) throws Exception{ responderpolicy obj = new responderpolicy(); responderpolicy[] response = (responderpolicy[])obj.get_resources(service); return response; }
java
{ "resource": "" }
q10929
responderpolicy.get
train
public static responderpolicy get(nitro_service service, String name) throws Exception{ responderpolicy obj = new responderpolicy(); obj.set_name(name); responderpolicy response = (responderpolicy) obj.get_resource(service); return response; }
java
{ "resource": "" }
q10930
hanode_routemonitor6_binding.get
train
public static hanode_routemonitor6_binding[] get(nitro_service service, Long id) throws Exception{ hanode_routemonitor6_binding obj = new hanode_routemonitor6_binding(); obj.set_id(id); hanode_routemonitor6_binding response[] = (hanode_routemonitor6_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q10931
MtasTerms.getIndexInputList
train
public HashMap<String, IndexInput> getIndexInputList() { HashMap<String, IndexInput> clonedIndexInputList = new HashMap<String, IndexInput>(); for (Entry<String, IndexInput> entry : indexInputList.entrySet()) { clonedIndexInputList.put(entry.getKey(), entry.getValue().clone()); } return clonedIndexInputList; }
java
{ "resource": "" }
q10932
systementitydata.delete
train
public static base_response delete(nitro_service client, systementitydata resource) throws Exception { systementitydata deleteresource = new systementitydata(); deleteresource.type = resource.type; deleteresource.name = resource.name; deleteresource.alldeleted = resource.alldeleted; deleteresource.allinactive = resource.allinactive; deleteresource.datasource = resource.datasource; deleteresource.core = resource.core; return deleteresource.delete_resource(client); }
java
{ "resource": "" }
q10933
systementitydata.get
train
public static systementitydata[] get(nitro_service service, systementitydata_args args) throws Exception{ systementitydata obj = new systementitydata(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); systementitydata[] response = (systementitydata[])obj.get_resources(service, option); return response; }
java
{ "resource": "" }
q10934
dos_stats.get
train
public static dos_stats get(nitro_service service, options option) throws Exception{ dos_stats obj = new dos_stats(); dos_stats[] response = (dos_stats[])obj.stat_resources(service,option); return response[0]; }
java
{ "resource": "" }
q10935
linkset.add
train
public static base_response add(nitro_service client, linkset resource) throws Exception { linkset addresource = new linkset(); addresource.id = resource.id; return addresource.add_resource(client); }
java
{ "resource": "" }
q10936
linkset.delete
train
public static base_response delete(nitro_service client, String id) throws Exception { linkset deleteresource = new linkset(); deleteresource.id = id; return deleteresource.delete_resource(client); }
java
{ "resource": "" }
q10937
linkset.get
train
public static linkset[] get(nitro_service service) throws Exception{ linkset obj = new linkset(); linkset[] response = (linkset[])obj.get_resources(service); return response; }
java
{ "resource": "" }
q10938
linkset.get
train
public static linkset get(nitro_service service, String id) throws Exception{ linkset obj = new linkset(); obj.set_id(id); linkset response = (linkset) obj.get_resource(service); return response; }
java
{ "resource": "" }
q10939
nsrollbackcmd.get
train
public static nsrollbackcmd get(nitro_service service) throws Exception{ nsrollbackcmd obj = new nsrollbackcmd(); nsrollbackcmd[] response = (nsrollbackcmd[])obj.get_resources(service); return response[0]; }
java
{ "resource": "" }
q10940
nsrollbackcmd.get
train
public static nsrollbackcmd[] get(nitro_service service, nsrollbackcmd_args args) throws Exception{ nsrollbackcmd obj = new nsrollbackcmd(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); nsrollbackcmd[] response = (nsrollbackcmd[])obj.get_resources(service, option); return response; }
java
{ "resource": "" }
q10941
MtasSolrComponentKwic.getPositiveInteger
train
private int getPositiveInteger(String number) { try { return Math.max(0, Integer.parseInt(number)); } catch (NumberFormatException e) { return 0; } }
java
{ "resource": "" }
q10942
cachepolicylabel_binding.get
train
public static cachepolicylabel_binding get(nitro_service service, String labelname) throws Exception{ cachepolicylabel_binding obj = new cachepolicylabel_binding(); obj.set_labelname(labelname); cachepolicylabel_binding response = (cachepolicylabel_binding) obj.get_resource(service); return response; }
java
{ "resource": "" }
q10943
sslvserver_sslciphersuite_binding.get
train
public static sslvserver_sslciphersuite_binding[] get(nitro_service service, String vservername) throws Exception{ sslvserver_sslciphersuite_binding obj = new sslvserver_sslciphersuite_binding(); obj.set_vservername(vservername); sslvserver_sslciphersuite_binding response[] = (sslvserver_sslciphersuite_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q10944
sslvserver_sslciphersuite_binding.count
train
public static long count(nitro_service service, String vservername) throws Exception{ sslvserver_sslciphersuite_binding obj = new sslvserver_sslciphersuite_binding(); obj.set_vservername(vservername); options option = new options(); option.set_count(true); sslvserver_sslciphersuite_binding response[] = (sslvserver_sslciphersuite_binding[]) obj.get_resources(service,option); if (response != null) { return response[0].__count; } return 0; }
java
{ "resource": "" }
q10945
nssimpleacl.add
train
public static base_response add(nitro_service client, nssimpleacl resource) throws Exception { nssimpleacl addresource = new nssimpleacl(); addresource.aclname = resource.aclname; addresource.aclaction = resource.aclaction; addresource.td = resource.td; addresource.srcip = resource.srcip; addresource.destport = resource.destport; addresource.protocol = resource.protocol; addresource.ttl = resource.ttl; return addresource.add_resource(client); }
java
{ "resource": "" }
q10946
nssimpleacl.clear
train
public static base_response clear(nitro_service client) throws Exception { nssimpleacl clearresource = new nssimpleacl(); return clearresource.perform_operation(client,"clear"); }
java
{ "resource": "" }
q10947
nssimpleacl.delete
train
public static base_response delete(nitro_service client, nssimpleacl resource) throws Exception { nssimpleacl deleteresource = new nssimpleacl(); deleteresource.aclname = resource.aclname; return deleteresource.delete_resource(client); }
java
{ "resource": "" }
q10948
nssimpleacl.flush
train
public static base_response flush(nitro_service client, nssimpleacl resource) throws Exception { nssimpleacl flushresource = new nssimpleacl(); flushresource.estsessions = resource.estsessions; return flushresource.perform_operation(client,"flush"); }
java
{ "resource": "" }
q10949
nssimpleacl.get
train
public static nssimpleacl[] get(nitro_service service) throws Exception{ nssimpleacl obj = new nssimpleacl(); nssimpleacl[] response = (nssimpleacl[])obj.get_resources(service); return response; }
java
{ "resource": "" }
q10950
nssimpleacl.get
train
public static nssimpleacl get(nitro_service service, String aclname) throws Exception{ nssimpleacl obj = new nssimpleacl(); obj.set_aclname(aclname); nssimpleacl response = (nssimpleacl) obj.get_resource(service); return response; }
java
{ "resource": "" }
q10951
nssimpleacl.get
train
public static nssimpleacl[] get(nitro_service service, String aclname[]) throws Exception{ if (aclname !=null && aclname.length>0) { nssimpleacl response[] = new nssimpleacl[aclname.length]; nssimpleacl obj[] = new nssimpleacl[aclname.length]; for (int i=0;i<aclname.length;i++) { obj[i] = new nssimpleacl(); obj[i].set_aclname(aclname[i]); response[i] = (nssimpleacl) obj[i].get_resource(service); } return response; } return null; }
java
{ "resource": "" }
q10952
nstimeout.update
train
public static base_response update(nitro_service client, nstimeout resource) throws Exception { nstimeout updateresource = new nstimeout(); updateresource.zombie = resource.zombie; updateresource.client = resource.client; updateresource.server = resource.server; updateresource.httpclient = resource.httpclient; updateresource.httpserver = resource.httpserver; updateresource.tcpclient = resource.tcpclient; updateresource.tcpserver = resource.tcpserver; updateresource.anyclient = resource.anyclient; updateresource.anyserver = resource.anyserver; updateresource.halfclose = resource.halfclose; updateresource.nontcpzombie = resource.nontcpzombie; updateresource.reducedfintimeout = resource.reducedfintimeout; updateresource.newconnidletimeout = resource.newconnidletimeout; return updateresource.update_resource(client); }
java
{ "resource": "" }
q10953
nstimeout.unset
train
public static base_response unset(nitro_service client, nstimeout resource, String[] args) throws Exception{ nstimeout unsetresource = new nstimeout(); return unsetresource.unset_resource(client,args); }
java
{ "resource": "" }
q10954
nstimeout.get
train
public static nstimeout get(nitro_service service) throws Exception{ nstimeout obj = new nstimeout(); nstimeout[] response = (nstimeout[])obj.get_resources(service); return response[0]; }
java
{ "resource": "" }
q10955
ListNERSequenceClassifier.readEntries
train
private Map<String, Entry> readEntries(String mapping, boolean ignoreCase) { Map<String, Entry> entries = new HashMap<>(); try { // ms, 2010-10-05: try to load the file from the CLASSPATH first InputStream is = getClass().getClassLoader().getResourceAsStream(mapping); // if not found in the CLASSPATH, load from the file system if (is == null) is = new FileInputStream(mapping); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); int lineCount = 0; for (String line; (line = rd.readLine()) != null; ) { lineCount ++; String[] split = line.split("\t"); if (split.length < 2 || split.length > 4) throw new RuntimeException("Provided mapping file is in wrong format"); if (split[1].trim().equalsIgnoreCase("AS")) System.err.println("ERRRR " + mapping + "|" + line + " at " + lineCount); String stringLine = split[1].trim(); if (ignoreCase) stringLine = stringLine.toLowerCase(); String[] words = stringLine.split("\\s+"); String type = split[0].trim(); Set<String> overwritableTypes = new HashSet<String>(); overwritableTypes.add(flags.backgroundSymbol); overwritableTypes.add(null); double priority = 0; List<String> tokens = new ArrayList<String>(); try { if (split.length >= 3) overwritableTypes.addAll(Arrays.asList(split[2].trim().split(","))); if (split.length == 4) priority = Double.parseDouble(split[3].trim()); for (String str : words) { tokens.add(str); } } catch(NumberFormatException e) { System.err.println("ERROR: Invalid line " + lineCount + " in regexner file " + mapping + ": \"" + line + "\"!"); throw e; } addEntry(words, type, priority, overwritableTypes); } rd.close(); is.close(); } catch (IOException e) { e.printStackTrace(); } return entries; }
java
{ "resource": "" }
q10956
HashableCoreMap.set
train
@Override public <VALUEBASE, VALUE extends VALUEBASE, KEY extends Key<CoreMap, VALUEBASE>> VALUE set(Class<KEY> key, VALUE value) { if (immutableKeys.contains(key)) { throw new HashableCoreMapException("Attempt to change value " + "of immutable field "+key.getSimpleName()); } return super.set(key, value); }
java
{ "resource": "" }
q10957
responderhtmlpage.Import
train
public static base_response Import(nitro_service client, responderhtmlpage resource) throws Exception { responderhtmlpage Importresource = new responderhtmlpage(); Importresource.src = resource.src; Importresource.name = resource.name; Importresource.comment = resource.comment; Importresource.overwrite = resource.overwrite; return Importresource.perform_operation(client,"Import"); }
java
{ "resource": "" }
q10958
responderhtmlpage.change
train
public static base_response change(nitro_service client, responderhtmlpage resource) throws Exception { responderhtmlpage updateresource = new responderhtmlpage(); updateresource.name = resource.name; return updateresource.perform_operation(client,"update"); }
java
{ "resource": "" }
q10959
responderhtmlpage.get
train
public static responderhtmlpage get(nitro_service service) throws Exception{ responderhtmlpage obj = new responderhtmlpage(); responderhtmlpage[] response = (responderhtmlpage[])obj.get_resources(service); return response[0]; }
java
{ "resource": "" }
q10960
responderhtmlpage.get
train
public static responderhtmlpage get(nitro_service service, String name) throws Exception{ responderhtmlpage obj = new responderhtmlpage(); obj.set_name(name); responderhtmlpage response = (responderhtmlpage) obj.get_resource(service); return response; }
java
{ "resource": "" }
q10961
GoldenSectionLineSearch.goldenMean
train
private double goldenMean(double a, double b) { if (geometric) { return a * Math.pow(b / a, GOLDEN_SECTION); } else { return a + (b - a) * GOLDEN_SECTION; } }
java
{ "resource": "" }
q10962
CRFClassifier.getNumWeights
train
public int getNumWeights() { if (weights == null) return 0; int numWeights = 0; for (double[] wts : weights) { numWeights += wts.length; } return numWeights; }
java
{ "resource": "" }
q10963
CRFClassifier.scaleWeights
train
public void scaleWeights(double scale) { for (int i = 0; i < weights.length; i++) { for (int j = 0; j < weights[i].length; j++) { weights[i][j] *= scale; } } }
java
{ "resource": "" }
q10964
CRFClassifier.combine
train
public void combine(CRFClassifier<IN> crf, double weight) { Timing timer = new Timing(); // Check the CRFClassifiers are compatible if (!this.pad.equals(crf.pad)) { throw new RuntimeException("Incompatible CRFClassifier: pad does not match"); } if (this.windowSize != crf.windowSize) { throw new RuntimeException("Incompatible CRFClassifier: windowSize does not match"); } if (this.labelIndices.length != crf.labelIndices.length) { // Should match since this should be same as the windowSize throw new RuntimeException("Incompatible CRFClassifier: labelIndices length does not match"); } this.classIndex.addAll(crf.classIndex.objectsList()); // Combine weights of the other classifier with this classifier, // weighing the other classifier's weights by weight // First merge the feature indicies int oldNumFeatures1 = this.featureIndex.size(); int oldNumFeatures2 = crf.featureIndex.size(); int oldNumWeights1 = this.getNumWeights(); int oldNumWeights2 = crf.getNumWeights(); this.featureIndex.addAll(crf.featureIndex.objectsList()); this.knownLCWords.addAll(crf.knownLCWords); assert (weights.length == oldNumFeatures1); // Combine weights of this classifier with other classifier for (int i = 0; i < labelIndices.length; i++) { this.labelIndices[i].addAll(crf.labelIndices[i].objectsList()); } System.err.println("Combining weights: will automatically match labelIndices"); combineWeights(crf, weight); int numFeatures = featureIndex.size(); int numWeights = getNumWeights(); long elapsedMs = timer.stop(); System.err.println("numFeatures: orig1=" + oldNumFeatures1 + ", orig2=" + oldNumFeatures2 + ", combined=" + numFeatures); System.err .println("numWeights: orig1=" + oldNumWeights1 + ", orig2=" + oldNumWeights2 + ", combined=" + numWeights); System.err.println("Time to combine CRFClassifier: " + Timing.toSecondsString(elapsedMs) + " seconds"); }
java
{ "resource": "" }
q10965
CRFClassifier.documentToDataAndLabels
train
public Pair<int[][][], int[]> documentToDataAndLabels(List<IN> document) { int docSize = document.size(); // first index is position in the document also the index of the // clique/factor table // second index is the number of elements in the clique/window these // features are for (starting with last element) // third index is position of the feature in the array that holds them // element in data[j][k][m] is the index of the mth feature occurring in // position k of the jth clique int[][][] data = new int[docSize][windowSize][]; // index is the position in the document // element in labels[j] is the index of the correct label (if it exists) at // position j of document int[] labels = new int[docSize]; if (flags.useReverse) { Collections.reverse(document); } // System.err.println("docSize:"+docSize); for (int j = 0; j < docSize; j++) { CRFDatum<List<String>, CRFLabel> d = makeDatum(document, j, featureFactory); List<List<String>> features = d.asFeatures(); for (int k = 0, fSize = features.size(); k < fSize; k++) { Collection<String> cliqueFeatures = features.get(k); data[j][k] = new int[cliqueFeatures.size()]; int m = 0; for (String feature : cliqueFeatures) { int index = featureIndex.indexOf(feature); if (index >= 0) { data[j][k][m] = index; m++; } else { // this is where we end up when we do feature threshold cutoffs } } // Reduce memory use when some features were cut out by threshold if (m < data[j][k].length) { int[] f = new int[m]; System.arraycopy(data[j][k], 0, f, 0, m); data[j][k] = f; } } IN wi = document.get(j); labels[j] = classIndex.indexOf(wi.get(AnswerAnnotation.class)); } if (flags.useReverse) { Collections.reverse(document); } // System.err.println("numClasses: "+classIndex.size()+" "+classIndex); // System.err.println("numDocuments: 1"); // System.err.println("numDatums: "+data.length); // System.err.println("numFeatures: "+featureIndex.size()); return new Pair<int[][][], int[]>(data, labels); }
java
{ "resource": "" }
q10966
CRFClassifier.documentsToDataAndLabels
train
public Pair<int[][][][], int[][]> documentsToDataAndLabels(Collection<List<IN>> documents) { // first index is the number of the document // second index is position in the document also the index of the // clique/factor table // third index is the number of elements in the clique/window these features // are for (starting with last element) // fourth index is position of the feature in the array that holds them // element in data[i][j][k][m] is the index of the mth feature occurring in // position k of the jth clique of the ith document // int[][][][] data = new int[documentsSize][][][]; List<int[][][]> data = new ArrayList<int[][][]>(); // first index is the number of the document // second index is the position in the document // element in labels[i][j] is the index of the correct label (if it exists) // at position j in document i // int[][] labels = new int[documentsSize][]; List<int[]> labels = new ArrayList<int[]>(); int numDatums = 0; for (List<IN> doc : documents) { Pair<int[][][], int[]> docPair = documentToDataAndLabels(doc); data.add(docPair.first()); labels.add(docPair.second()); numDatums += doc.size(); } System.err.println("numClasses: " + classIndex.size() + ' ' + classIndex); System.err.println("numDocuments: " + data.size()); System.err.println("numDatums: " + numDatums); System.err.println("numFeatures: " + featureIndex.size()); printFeatures(); int[][][][] dataA = new int[0][][][]; int[][] labelsA = new int[0][]; return new Pair<int[][][][], int[][]>(data.toArray(dataA), labels.toArray(labelsA)); }
java
{ "resource": "" }
q10967
CRFClassifier.documentsToDataAndLabelsList
train
public List<Pair<int[][][], int[]>> documentsToDataAndLabelsList(Collection<List<IN>> documents) { int numDatums = 0; List<Pair<int[][][], int[]>> docList = new ArrayList<Pair<int[][][], int[]>>(); for (List<IN> doc : documents) { Pair<int[][][], int[]> docPair = documentToDataAndLabels(doc); docList.add(docPair); numDatums += doc.size(); } System.err.println("numClasses: " + classIndex.size() + ' ' + classIndex); System.err.println("numDocuments: " + docList.size()); System.err.println("numDatums: " + numDatums); System.err.println("numFeatures: " + featureIndex.size()); return docList; }
java
{ "resource": "" }
q10968
CRFClassifier.makeDatum
train
public CRFDatum<List<String>, CRFLabel> makeDatum(List<IN> info, int loc, edu.stanford.nlp.sequences.FeatureFactory<IN> featureFactory) { pad.set(AnswerAnnotation.class, flags.backgroundSymbol); PaddedList<IN> pInfo = new PaddedList<IN>(info, pad); ArrayList<List<String>> features = new ArrayList<List<String>>(); // for (int i = 0; i < windowSize; i++) { // List featuresC = new ArrayList(); // for (int j = 0; j < FeatureFactory.win[i].length; j++) { // featuresC.addAll(featureFactory.features(info, loc, // FeatureFactory.win[i][j])); // } // features.add(featuresC); // } Collection<Clique> done = new HashSet<Clique>(); for (int i = 0; i < windowSize; i++) { List<String> featuresC = new ArrayList<String>(); List<Clique> windowCliques = FeatureFactory.getCliques(i, 0); windowCliques.removeAll(done); done.addAll(windowCliques); for (Clique c : windowCliques) { featuresC.addAll(featureFactory.getCliqueFeatures(pInfo, loc, c)); //todo useless copy because of typing reasons } features.add(featuresC); } int[] labels = new int[windowSize]; for (int i = 0; i < windowSize; i++) { String answer = pInfo.get(loc + i - windowSize + 1).get(AnswerAnnotation.class); labels[i] = classIndex.indexOf(answer); } printFeatureLists(pInfo.get(loc), features); CRFDatum<List<String>, CRFLabel> d = new CRFDatum<List<String>, CRFLabel>(features, new CRFLabel(labels)); // System.err.println(d); return d; }
java
{ "resource": "" }
q10969
CRFClassifier.getCliqueTrees
train
public List<CRFCliqueTree> getCliqueTrees(String filename, DocumentReaderAndWriter<IN> readerAndWriter) { // only for the OCR data does this matter flags.ocrTrain = false; List<CRFCliqueTree> cts = new ArrayList<CRFCliqueTree>(); ObjectBank<List<IN>> docs = makeObjectBankFromFile(filename, readerAndWriter); for (List<IN> doc : docs) { cts.add(getCliqueTree(doc)); } return cts; }
java
{ "resource": "" }
q10970
CRFClassifier.extractDatumSequence
train
protected List<CRFDatum> extractDatumSequence(int[][][] allData, int beginPosition, int endPosition, List<IN> labeledWordInfos) { List<CRFDatum> result = new ArrayList<CRFDatum>(); int beginContext = beginPosition - windowSize + 1; if (beginContext < 0) { beginContext = 0; } // for the beginning context, add some dummy datums with no features! // TODO: is there any better way to do this? for (int position = beginContext; position < beginPosition; position++) { List<Collection<String>> cliqueFeatures = new ArrayList<Collection<String>>(); for (int i = 0; i < windowSize; i++) { // create a feature list cliqueFeatures.add(Collections.<String>emptyList()); } CRFDatum<Collection<String>, String> datum = new CRFDatum<Collection<String>, String>(cliqueFeatures, labeledWordInfos.get(position).get(AnswerAnnotation.class)); result.add(datum); } // now add the real datums for (int position = beginPosition; position <= endPosition; position++) { List<Collection<String>> cliqueFeatures = new ArrayList<Collection<String>>(); for (int i = 0; i < windowSize; i++) { // create a feature list Collection<String> features = new ArrayList<String>(); for (int j = 0; j < allData[position][i].length; j++) { features.add(featureIndex.get(allData[position][i][j])); } cliqueFeatures.add(features); } CRFDatum<Collection<String>,String> datum = new CRFDatum<Collection<String>,String>(cliqueFeatures, labeledWordInfos.get(position).get(AnswerAnnotation.class)); result.add(datum); } return result; }
java
{ "resource": "" }
q10971
CRFClassifier.addProcessedData
train
protected void addProcessedData(List<List<CRFDatum<Collection<String>, String>>> processedData, int[][][][] data, int[][] labels, int offset) { for (int i = 0, pdSize = processedData.size(); i < pdSize; i++) { int dataIndex = i + offset; List<CRFDatum<Collection<String>, String>> document = processedData.get(i); int dsize = document.size(); labels[dataIndex] = new int[dsize]; data[dataIndex] = new int[dsize][][]; for (int j = 0; j < dsize; j++) { CRFDatum<Collection<String>, String> crfDatum = document.get(j); // add label, they are offset by extra context labels[dataIndex][j] = classIndex.indexOf(crfDatum.label()); // add features List<Collection<String>> cliques = crfDatum.asFeatures(); int csize = cliques.size(); data[dataIndex][j] = new int[csize][]; for (int k = 0; k < csize; k++) { Collection<String> features = cliques.get(k); // Debug only: Remove // if (j < windowSize) { // System.err.println("addProcessedData: Features Size: " + // features.size()); // } data[dataIndex][j][k] = new int[features.size()]; int m = 0; try { for (String feature : features) { // System.err.println("feature " + feature); // if (featureIndex.indexOf(feature)) ; if (featureIndex == null) { System.out.println("Feature is NULL!"); } data[dataIndex][j][k][m] = featureIndex.indexOf(feature); m++; } } catch (Exception e) { e.printStackTrace(); System.err.printf("[index=%d, j=%d, k=%d, m=%d]\n", dataIndex, j, k, m); System.err.println("data.length " + data.length); System.err.println("data[dataIndex].length " + data[dataIndex].length); System.err.println("data[dataIndex][j].length " + data[dataIndex][j].length); System.err.println("data[dataIndex][j][k].length " + data[dataIndex][j].length); System.err.println("data[dataIndex][j][k][m] " + data[dataIndex][j][k][m]); return; } } } } }
java
{ "resource": "" }
q10972
CRFClassifier.getJarClassifier
train
public static <IN extends CoreMap> CRFClassifier<IN> getJarClassifier(String resourceName, Properties props) { CRFClassifier<IN> crf = new CRFClassifier<IN>(); crf.loadJarClassifier(resourceName, props); return crf; }
java
{ "resource": "" }
q10973
CRFClassifier.getClassifier
train
public static <IN extends CoreMap> CRFClassifier<IN> getClassifier(File file) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier<IN> crf = new CRFClassifier<IN>(); crf.loadClassifier(file); return crf; }
java
{ "resource": "" }
q10974
CRFClassifier.getClassifier
train
public static CRFClassifier getClassifier(InputStream in) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier crf = new CRFClassifier(); crf.loadClassifier(in); return crf; }
java
{ "resource": "" }
q10975
CRFClassifier.main
train
public static void main(String[] args) throws Exception { StringUtils.printErrInvocationString("CRFClassifier", args); Properties props = StringUtils.argsToProperties(args); CRFClassifier<CoreLabel> crf = new CRFClassifier<CoreLabel>(props); String testFile = crf.flags.testFile; String textFile = crf.flags.textFile; String loadPath = crf.flags.loadClassifier; String loadTextPath = crf.flags.loadTextClassifier; String serializeTo = crf.flags.serializeTo; String serializeToText = crf.flags.serializeToText; if (loadPath != null) { crf.loadClassifierNoExceptions(loadPath, props); } else if (loadTextPath != null) { System.err.println("Warning: this is now only tested for Chinese Segmenter"); System.err.println("(Sun Dec 23 00:59:39 2007) (pichuan)"); try { crf.loadTextClassifier(loadTextPath, props); // System.err.println("DEBUG: out from crf.loadTextClassifier"); } catch (Exception e) { throw new RuntimeException("error loading " + loadTextPath, e); } } else if (crf.flags.loadJarClassifier != null) { crf.loadJarClassifier(crf.flags.loadJarClassifier, props); } else if (crf.flags.trainFile != null || crf.flags.trainFileList != null) { crf.train(); } else { crf.loadDefaultClassifier(); } // System.err.println("Using " + crf.flags.featureFactory); // System.err.println("Using " + // StringUtils.getShortClassName(crf.readerAndWriter)); if (serializeTo != null) { crf.serializeClassifier(serializeTo); } if (serializeToText != null) { crf.serializeTextClassifier(serializeToText); } if (testFile != null) { DocumentReaderAndWriter<CoreLabel> readerAndWriter = crf.makeReaderAndWriter(); if (crf.flags.searchGraphPrefix != null) { crf.classifyAndWriteViterbiSearchGraph(testFile, crf.flags.searchGraphPrefix, crf.makeReaderAndWriter()); } else if (crf.flags.printFirstOrderProbs) { crf.printFirstOrderProbs(testFile, readerAndWriter); } else if (crf.flags.printProbs) { crf.printProbs(testFile, readerAndWriter); } else if (crf.flags.useKBest) { int k = crf.flags.kBest; crf.classifyAndWriteAnswersKBest(testFile, k, readerAndWriter); } else if (crf.flags.printLabelValue) { crf.printLabelInformation(testFile, readerAndWriter); } else { crf.classifyAndWriteAnswers(testFile, readerAndWriter); } } if (textFile != null) { crf.classifyAndWriteAnswers(textFile); } if (crf.flags.readStdin) { crf.classifyStdin(); } }
java
{ "resource": "" }
q10976
appfwglobal_auditsyslogpolicy_binding.get
train
public static appfwglobal_auditsyslogpolicy_binding[] get(nitro_service service) throws Exception{ appfwglobal_auditsyslogpolicy_binding obj = new appfwglobal_auditsyslogpolicy_binding(); appfwglobal_auditsyslogpolicy_binding response[] = (appfwglobal_auditsyslogpolicy_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q10977
csvserver_cmppolicy_binding.get
train
public static csvserver_cmppolicy_binding[] get(nitro_service service, String name) throws Exception{ csvserver_cmppolicy_binding obj = new csvserver_cmppolicy_binding(); obj.set_name(name); csvserver_cmppolicy_binding response[] = (csvserver_cmppolicy_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q10978
ipset_nsip_binding.get
train
public static ipset_nsip_binding[] get(nitro_service service, String name) throws Exception{ ipset_nsip_binding obj = new ipset_nsip_binding(); obj.set_name(name); ipset_nsip_binding response[] = (ipset_nsip_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q10979
appfwlearningdata.delete
train
public static base_response delete(nitro_service client, appfwlearningdata resource) throws Exception { appfwlearningdata deleteresource = new appfwlearningdata(); deleteresource.profilename = resource.profilename; deleteresource.starturl = resource.starturl; deleteresource.cookieconsistency = resource.cookieconsistency; deleteresource.fieldconsistency = resource.fieldconsistency; deleteresource.formactionurl_ffc = resource.formactionurl_ffc; deleteresource.crosssitescripting = resource.crosssitescripting; deleteresource.formactionurl_xss = resource.formactionurl_xss; deleteresource.sqlinjection = resource.sqlinjection; deleteresource.formactionurl_sql = resource.formactionurl_sql; deleteresource.fieldformat = resource.fieldformat; deleteresource.formactionurl_ff = resource.formactionurl_ff; deleteresource.csrftag = resource.csrftag; deleteresource.csrfformoriginurl = resource.csrfformoriginurl; deleteresource.xmldoscheck = resource.xmldoscheck; deleteresource.xmlwsicheck = resource.xmlwsicheck; deleteresource.xmlattachmentcheck = resource.xmlattachmentcheck; deleteresource.totalxmlrequests = resource.totalxmlrequests; return deleteresource.delete_resource(client); }
java
{ "resource": "" }
q10980
appfwlearningdata.delete
train
public static base_responses delete(nitro_service client, appfwlearningdata resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { appfwlearningdata deleteresources[] = new appfwlearningdata[resources.length]; for (int i=0;i<resources.length;i++){ deleteresources[i] = new appfwlearningdata(); deleteresources[i].profilename = resources[i].profilename; deleteresources[i].starturl = resources[i].starturl; deleteresources[i].cookieconsistency = resources[i].cookieconsistency; deleteresources[i].fieldconsistency = resources[i].fieldconsistency; deleteresources[i].formactionurl_ffc = resources[i].formactionurl_ffc; deleteresources[i].crosssitescripting = resources[i].crosssitescripting; deleteresources[i].formactionurl_xss = resources[i].formactionurl_xss; deleteresources[i].sqlinjection = resources[i].sqlinjection; deleteresources[i].formactionurl_sql = resources[i].formactionurl_sql; deleteresources[i].fieldformat = resources[i].fieldformat; deleteresources[i].formactionurl_ff = resources[i].formactionurl_ff; deleteresources[i].csrftag = resources[i].csrftag; deleteresources[i].csrfformoriginurl = resources[i].csrfformoriginurl; deleteresources[i].xmldoscheck = resources[i].xmldoscheck; deleteresources[i].xmlwsicheck = resources[i].xmlwsicheck; deleteresources[i].xmlattachmentcheck = resources[i].xmlattachmentcheck; deleteresources[i].totalxmlrequests = resources[i].totalxmlrequests; } result = delete_bulk_request(client, deleteresources); } return result; }
java
{ "resource": "" }
q10981
appfwlearningdata.reset
train
public static base_response reset(nitro_service client) throws Exception { appfwlearningdata resetresource = new appfwlearningdata(); return resetresource.perform_operation(client,"reset"); }
java
{ "resource": "" }
q10982
appfwlearningdata.reset
train
public static base_responses reset(nitro_service client, appfwlearningdata resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { appfwlearningdata resetresources[] = new appfwlearningdata[resources.length]; for (int i=0;i<resources.length;i++){ resetresources[i] = new appfwlearningdata(); } result = perform_operation_bulk_request(client, resetresources,"reset"); } return result; }
java
{ "resource": "" }
q10983
appfwlearningdata.export
train
public static base_response export(nitro_service client, appfwlearningdata resource) throws Exception { appfwlearningdata exportresource = new appfwlearningdata(); exportresource.profilename = resource.profilename; exportresource.securitycheck = resource.securitycheck; exportresource.target = resource.target; return exportresource.perform_operation(client,"export"); }
java
{ "resource": "" }
q10984
appfwlearningdata.export
train
public static base_responses export(nitro_service client, appfwlearningdata resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { appfwlearningdata exportresources[] = new appfwlearningdata[resources.length]; for (int i=0;i<resources.length;i++){ exportresources[i] = new appfwlearningdata(); exportresources[i].profilename = resources[i].profilename; exportresources[i].securitycheck = resources[i].securitycheck; exportresources[i].target = resources[i].target; } result = perform_operation_bulk_request(client, exportresources,"export"); } return result; }
java
{ "resource": "" }
q10985
appfwlearningdata.get
train
public static appfwlearningdata[] get(nitro_service service, appfwlearningdata_args args) throws Exception{ appfwlearningdata obj = new appfwlearningdata(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); appfwlearningdata[] response = (appfwlearningdata[])obj.get_resources(service, option); return response; }
java
{ "resource": "" }
q10986
appfwprofile_safeobject_binding.get
train
public static appfwprofile_safeobject_binding[] get(nitro_service service, String name) throws Exception{ appfwprofile_safeobject_binding obj = new appfwprofile_safeobject_binding(); obj.set_name(name); appfwprofile_safeobject_binding response[] = (appfwprofile_safeobject_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q10987
tmsessionpolicy_binding.get
train
public static tmsessionpolicy_binding get(nitro_service service, String name) throws Exception{ tmsessionpolicy_binding obj = new tmsessionpolicy_binding(); obj.set_name(name); tmsessionpolicy_binding response = (tmsessionpolicy_binding) obj.get_resource(service); return response; }
java
{ "resource": "" }
q10988
vpnvserver_auditnslogpolicy_binding.get
train
public static vpnvserver_auditnslogpolicy_binding[] get(nitro_service service, String name) throws Exception{ vpnvserver_auditnslogpolicy_binding obj = new vpnvserver_auditnslogpolicy_binding(); obj.set_name(name); vpnvserver_auditnslogpolicy_binding response[] = (vpnvserver_auditnslogpolicy_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q10989
LogConditionalObjectiveFunction.calculateSCL
train
private void calculateSCL(double[] x) { //System.out.println("Checking at: "+x[0]+" "+x[1]+" "+x[2]); value = 0.0; Arrays.fill(derivative, 0.0); double[] sums = new double[numClasses]; double[] probs = new double[numClasses]; double[] counts = new double[numClasses]; Arrays.fill(counts, 0.0); for (int d = 0; d < data.length; d++) { // if (d == testMin) { // d = testMax - 1; // continue; // } int[] features = data[d]; // activation Arrays.fill(sums, 0.0); for (int c = 0; c < numClasses; c++) { for (int f = 0; f < features.length; f++) { int i = indexOf(features[f], c); sums[c] += x[i]; } } // expectation (slower routine replaced by fast way) // double total = Double.NEGATIVE_INFINITY; // for (int c=0; c<numClasses; c++) { // total = SloppyMath.logAdd(total, sums[c]); // } double total = ArrayMath.logSum(sums); int ld = labels[d]; for (int c = 0; c < numClasses; c++) { probs[c] = Math.exp(sums[c] - total); for (int f = 0; f < features.length; f++) { int i = indexOf(features[f], c); derivative[i] += probs[ld] * probs[c]; } } // observed for (int f = 0; f < features.length; f++) { int i = indexOf(features[f], labels[d]); derivative[i] -= probs[ld]; } value -= probs[ld]; } // priors if (true) { for (int i = 0; i < x.length; i++) { double k = 1.0; double w = x[i]; value += k * w * w / 2.0; derivative[i] += k * w; } } }
java
{ "resource": "" }
q10990
vrid6.get
train
public static vrid6[] get(nitro_service service) throws Exception{ vrid6 obj = new vrid6(); vrid6[] response = (vrid6[])obj.get_resources(service); return response; }
java
{ "resource": "" }
q10991
vrid6.get
train
public static vrid6 get(nitro_service service, Long id) throws Exception{ vrid6 obj = new vrid6(); obj.set_id(id); vrid6 response = (vrid6) obj.get_resource(service); return response; }
java
{ "resource": "" }
q10992
CoNLLDocumentReaderAndWriter.splitIntoDocs
train
private static Iterator<String> splitIntoDocs(Reader r) { if (TREAT_FILE_AS_ONE_DOCUMENT) { return Collections.singleton(IOUtils.slurpReader(r)).iterator(); } else { Collection<String> docs = new ArrayList<String>(); ObjectBank<String> ob = ObjectBank.getLineIterator(r); StringBuilder current = new StringBuilder(); for (String line : ob) { if (docPattern.matcher(line).lookingAt()) { // Start new doc, store old one if non-empty if (current.length() > 0) { docs.add(current.toString()); current = new StringBuilder(); } } current.append(line); current.append('\n'); } if (current.length() > 0) { docs.add(current.toString()); } return docs.iterator(); } }
java
{ "resource": "" }
q10993
CoNLLDocumentReaderAndWriter.makeCoreLabel
train
private CoreLabel makeCoreLabel(String line) { CoreLabel wi = new CoreLabel(); // wi.line = line; String[] bits = line.split("\\s+"); switch (bits.length) { case 0: case 1: wi.setWord(BOUNDARY); wi.set(AnswerAnnotation.class, OTHER); break; case 2: wi.setWord(bits[0]); wi.set(AnswerAnnotation.class, bits[1]); break; case 3: wi.setWord(bits[0]); wi.setTag(bits[1]); wi.set(AnswerAnnotation.class, bits[2]); break; case 4: wi.setWord(bits[0]); wi.setTag(bits[1]); wi.set(ChunkAnnotation.class, bits[2]); wi.set(AnswerAnnotation.class, bits[3]); break; case 5: if (flags.useLemmaAsWord) { wi.setWord(bits[1]); } else { wi.setWord(bits[0]); } wi.set(LemmaAnnotation.class, bits[1]); wi.setTag(bits[2]); wi.set(ChunkAnnotation.class, bits[3]); wi.set(AnswerAnnotation.class, bits[4]); break; default: throw new RuntimeIOException("Unexpected input (many fields): " + line); } wi.set(OriginalAnswerAnnotation.class, wi.get(AnswerAnnotation.class)); return wi; }
java
{ "resource": "" }
q10994
CoNLLDocumentReaderAndWriter.deEndify
train
private void deEndify(List<CoreLabel> tokens) { if (flags.retainEntitySubclassification) { return; } tokens = new PaddedList<CoreLabel>(tokens, new CoreLabel()); int k = tokens.size(); String[] newAnswers = new String[k]; for (int i = 0; i < k; i++) { CoreLabel c = tokens.get(i); CoreLabel p = tokens.get(i - 1); if (c.get(AnswerAnnotation.class).length() > 1 && c.get(AnswerAnnotation.class).charAt(1) == '-') { String base = c.get(AnswerAnnotation.class).substring(2); String pBase = (p.get(AnswerAnnotation.class).length() <= 2 ? p.get(AnswerAnnotation.class) : p.get(AnswerAnnotation.class).substring(2)); boolean isSecond = (base.equals(pBase)); boolean isStart = (c.get(AnswerAnnotation.class).charAt(0) == 'B' || c.get(AnswerAnnotation.class).charAt(0) == 'S'); if (isSecond && isStart) { newAnswers[i] = intern("B-" + base); } else { newAnswers[i] = intern("I-" + base); } } else { newAnswers[i] = c.get(AnswerAnnotation.class); } } for (int i = 0; i < k; i++) { CoreLabel c = tokens.get(i); c.set(AnswerAnnotation.class, newAnswers[i]); } }
java
{ "resource": "" }
q10995
CoNLLDocumentReaderAndWriter.printAnswers
train
public void printAnswers(List<CoreLabel> doc, PrintWriter out) { // boolean tagsMerged = flags.mergeTags; // boolean useHead = flags.splitOnHead; if ( ! "iob1".equalsIgnoreCase(flags.entitySubclassification)) { deEndify(doc); } for (CoreLabel fl : doc) { String word = fl.word(); if (word == BOUNDARY) { // Using == is okay, because it is set to constant out.println(); } else { String gold = fl.get(OriginalAnswerAnnotation.class); if(gold == null) gold = ""; String guess = fl.get(AnswerAnnotation.class); // System.err.println(fl.word() + "\t" + fl.get(AnswerAnnotation.class) + "\t" + fl.get(AnswerAnnotation.class)); String pos = fl.tag(); String chunk = (fl.get(ChunkAnnotation.class) == null ? "" : fl.get(ChunkAnnotation.class)); out.println(fl.word() + '\t' + pos + '\t' + chunk + '\t' + gold + '\t' + guess); } } }
java
{ "resource": "" }
q10996
CoNLLDocumentReaderAndWriter.main
train
public static void main(String[] args) throws IOException, ClassNotFoundException { CoNLLDocumentReaderAndWriter f = new CoNLLDocumentReaderAndWriter(); f.init(new SeqClassifierFlags()); int numDocs = 0; int numTokens = 0; int numEntities = 0; String lastAnsBase = ""; for (Iterator<List<CoreLabel>> it = f.getIterator(new FileReader(args[0])); it.hasNext(); ) { List<CoreLabel> doc = it.next(); numDocs++; for (CoreLabel fl : doc) { // System.out.println("FL " + (++i) + " was " + fl); if (fl.word().equals(BOUNDARY)) { continue; } String ans = fl.get(AnswerAnnotation.class); String ansBase; String ansPrefix; String[] bits = ans.split("-"); if (bits.length == 1) { ansBase = bits[0]; ansPrefix = ""; } else { ansBase = bits[1]; ansPrefix = bits[0]; } numTokens++; if (ansBase.equals("O")) { } else if (ansBase.equals(lastAnsBase)) { if (ansPrefix.equals("B")) { numEntities++; } } else { numEntities++; } } } System.out.println("File " + args[0] + " has " + numDocs + " documents, " + numTokens + " (non-blank line) tokens and " + numEntities + " entities."); }
java
{ "resource": "" }
q10997
AbstractStochasticCachingDiffFunction.getBatch
train
protected void getBatch(int batchSize){ // if (numCalls == 0) { // for (int i = 0; i < 1538*\15; i++) { // randGenerator.nextInt(this.dataDimension()); // } // } // numCalls++; if (thisBatch == null || thisBatch.length != batchSize){ thisBatch = new int[batchSize]; } //----------------------------- //RANDOM WITH REPLACEMENT //----------------------------- if (sampleMethod.equals(SamplingMethod.RandomWithReplacement)){ for(int i = 0; i<batchSize;i++){ thisBatch[i] = randGenerator.nextInt(this.dataDimension()); //Just generate a random index // System.err.println("numCalls = "+(numCalls++)); } //----------------------------- //ORDERED //----------------------------- }else if(sampleMethod.equals(SamplingMethod.Ordered)){ for(int i = 0; i<batchSize;i++){ thisBatch[i] = (curElement + i) % this.dataDimension() ; //Take the next batchSize points in order } curElement = (curElement + batchSize) % this.dataDimension(); //watch out for overflow //----------------------------- //RANDOM WITHOUT REPLACEMENT //----------------------------- }else if(sampleMethod.equals(SamplingMethod.RandomWithoutReplacement)){ //Declare the indices array if needed. if (allIndices == null || allIndices.size()!= this.dataDimension()){ allIndices = new ArrayList<Integer>(); for(int i=0;i<this.dataDimension();i++){ allIndices.add(i); } Collections.shuffle(allIndices,randGenerator); } for(int i = 0; i<batchSize;i++){ thisBatch[i] = allIndices.get((curElement + i) % allIndices.size()); //Grab the next batchSize indices } if (curElement + batchSize > this.dataDimension()){ Collections.shuffle(Arrays.asList(allIndices),randGenerator); //Shuffle if we got to the end of the list } //watch out for overflow curElement = (curElement + batchSize) % allIndices.size(); //Rollover }else{ System.err.println("NO SAMPLING METHOD SELECTED"); System.exit(1); } }
java
{ "resource": "" }
q10998
server_service_binding.get
train
public static server_service_binding[] get(nitro_service service, String name) throws Exception{ server_service_binding obj = new server_service_binding(); obj.set_name(name); server_service_binding response[] = (server_service_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q10999
MobicentsCache.setReplicationClassLoader
train
@SuppressWarnings("rawtypes") public void setReplicationClassLoader(Fqn regionFqn, ClassLoader classLoader) { if (!isLocalMode()) { final Region region = jBossCache.getRegion(regionFqn, true); region.registerContextClassLoader(classLoader); if (!region.isActive() && jBossCache.getCacheStatus() == CacheStatus.STARTED) { region.activate(); } } }
java
{ "resource": "" }