@SuppressWarnings("unchecked") protected int checkType(String string, MultiValueMap stringTreeMap) { Collection<StringTree> values = stringTreeMap.values(); int errors = 0; for (StringTree tree : values) { if ((string.equals("MOD") && tree.isAuxtree()) || (string.equals("ARG") && !tree.isAuxtree())) { //ok } else { System.err.println("wrong tree type: " + string + tree.getStructure(tree.getRoot(), opts.useSemantics)); errors++; } } return errors; }
private void updateEntryWithRolesMap(MultiValueMap<String, LexiconEntryWithRoles> map, String key, LexiconEntryWithRoles entry, String unlexEntryWithSemantics) { Collection<LexiconEntryWithRoles> col = map.getCollection(key); if(col != null && col.contains(entry)) { for(LexiconEntryWithRoles e : col) { if(entry.equals(e)) // syntactically same tree with (potentially) different role assignments { e.addEntry(entry, unlexEntryWithSemantics); break; } } // for } // if else { map.put(key, entry); } }
public SemanticsPerformance(Indexer<String> roleIndexer, Map<Integer, Integer> roleFreqs) { evalb = new EvalbImpl("Evalb LP/LR", true); TreebankLangParserParams tlpp = Languages.getLanguageParams(Languages.Language.English); tlpp.setInputEncoding("UTF-8"); treeCollinizer = tlpp.collinizer(); conllRoleIndexer = roleIndexer; numOfRoles = roleIndexer.size(); this.roleFreqs = roleFreqs; counts = new int[numOfRoles + 1][numOfRoles + 1]; correctCounts = new int[numOfRoles]; goldCounts = new int[numOfRoles]; srlResult = new EvalResult(); predResult = new EvalResult(); argsResult = new EvalResult(); errorsMap = new MultiValueMap<String, String>(); }
/** * Create a map of nodes that have a role. Note, we split role signatures into * individual nodes with roles; this might potentially result in combinations of roles * in trees not existing in the training set. * @param tree an ElementaryStringTree with potential roles attached to it * @param offset the node id offset. This is the highest node id of the prefix tree. * @return */ private MultiValueMap<Integer, Role> getRolesPerNode(ElementaryStringTree tree, short offset) { MultiValueMap<Integer, Role> roleMap = new MultiValueMap(); for(RoleSignature sig : tree.getRoleSignatures()) { for(Role role : sig.getRoles().values()) // wrong! It might result in combination of roles in trees not existing in the training set { int newId = role.getNodeId() + offset; Collection<Role> rolesPerNode = roleMap.getCollection(newId); if(rolesPerNode == null || !rolesPerNode.contains(role)) // if the collection is empty and doesn't contain the same role roleMap.put(newId, role); if(role.secondRoleNameId != null) // make sure we treat roles with multiple argument labels separately (e.g., @ARG1;@ARG0) { Role secondRole = new Role(role.roleIndexer, role.secondRoleNameId, role.nodeId); if(!roleMap.getCollection(newId).contains(secondRole)) roleMap.put(newId, secondRole); } } } return roleMap; }
public PredictionStringTree copyPred(){ PredictionStringTree copy = new PredictionStringTree(this.arraysize, useSemantics); copy.fullcategories = this.fullcategories.clone(); copy.categories = this.categories.clone(); copy.roles = this.roles.clone(); copy.nodeTypes = this.nodeTypes.clone(); copy.parent = this.parent.clone(); copy.isHeadChild = this.isHeadChild.clone(); copy.children = (HashMap<Integer, ArrayList<Integer>>) this.children.clone(); copy.origin = new MultiValueMap(); copy.origin.putAll(this.origin); copy.originDown = new MultiValueMap(); copy.originDown.putAll(this.originDown); copy.originUp = new MultiValueMap(); copy.originUp.putAll(this.originUp); //copy.indexUp = this.indexUp.clone(); copy.root = this.root; copy.foot = this.foot; copy.auxtree = this.auxtree; copy.arraysize = this.arraysize; //copy.adjPossible = this.adjPossible.clone(); return copy; }
private void makeMapping(MultiValueMap<Integer, Integer> origin) { Iterator valuit = origin.values().iterator(); HashMap<Integer, Boolean> singlevals = new HashMap<Integer, Boolean>(); int maxval = -1; while (valuit.hasNext()){ Integer val = (Integer) valuit.next(); singlevals.put(val, true); if (val > maxval){maxval = val;} // if (Integer.parseInt(val) > maxval){maxval = Integer.parseInt(val);} } Boolean[] v = new Boolean[maxval+1]; for (Integer key : singlevals.keySet()){ // for (String key : singlevals.keySet()){ // int intkey= Integer.parseInt(intkey); v[key]= true; } mapping = new int[maxval+1]; int j=1; for (int i = 0; i < v.length; i++){ if (v[i] != null){ mapping[i] = j; // mapping[i] = j+""; j++; } } }
@org.junit.Test(timeout = 1000) public void testPopulateMultiMap_add2677() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_add2677"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "x1")); list.add(new X(1 , "x1")); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testPopulateMultiMap_add2678() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_add2678"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "x1")); list.add(new X(2 , "x2")); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testPopulateMultiMap_add2679() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_add2679"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "x1")); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testPopulateMultiMap_add2680() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_add2680"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "x1")); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testPopulateMultiMap_add2681() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_add2681"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "x1")); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testPopulateMultiMap_add2683() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_add2683"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "x1")); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testPopulateMultiMap() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap"); final List<X> list = new ArrayList<X>(); list.add(new X(0 , "x1")); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testPopulateMultiMap_literalMutation2796() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_literalMutation2796"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "foo")); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testPopulateMultiMap_literalMutation2797() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_literalMutation2797"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "x1")); list.add(new X(1 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testPopulateMultiMap_literalMutation2798() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_literalMutation2798"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "x1")); list.add(new X(2 , "foo")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testPopulateMultiMap_literalMutation2799() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_literalMutation2799"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "x1")); list.add(new X(2 , "x2")); list.add(new X(3 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testPopulateMultiMap_literalMutation2800() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_literalMutation2800"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "x1")); list.add(new X(2 , "x2")); list.add(new X(2 , "foo")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testPopulateMultiMap_literalMutation2801() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_literalMutation2801"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "x1")); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(4 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testPopulateMultiMap_literalMutation2802() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_literalMutation2802"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "x1")); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "foo")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testPopulateMultiMap_literalMutation2803() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_literalMutation2803"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "x1")); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(4 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testPopulateMultiMap_literalMutation2804() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_literalMutation2804"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "x1")); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "foo")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
public void testPopulateMultiMap_literalMutation2805() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_literalMutation2805"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "x1")); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = -1 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testPopulateMultiMap_remove2120() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_remove2120"); final List<X> list = new ArrayList<X>(); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testPopulateMultiMap_remove2121() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_remove2121"); final List<X> list = new ArrayList<X>(); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testPopulateMultiMap_remove2122() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_remove2122"); final List<X> list = new ArrayList<X>(); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testPopulateMultiMap_remove2123() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_remove2123"); final List<X> list = new ArrayList<X>(); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testPopulateMultiMap_remove2124() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_remove2124"); final List<X> list = new ArrayList<X>(); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testPopulateMultiMap_remove2125() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_remove2125"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "x1")); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
@org.junit.Test(timeout = 1000) public void testPopulateMultiMap_remove2126() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testPopulateMultiMap_remove2126"); final List<X> list = new ArrayList<X>(); list.add(new X(1 , "x1")); list.add(new X(2 , "x2")); list.add(new X(2 , "x3")); list.add(new X(5 , "x4")); list.add(new X(5 , "x5")); final MultiValueMap<java.lang.Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<java.lang.Integer, java.util.Collection<X>>()); org.apache.commons.collections4.MapUtils.populateMap(map, list, new Transformer<X, java.lang.Integer>() { public Integer transform(X input) { return input.key; } }, org.apache.commons.collections4.TransformerUtils.<X>nopTransformer()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7893,list,7892,list.size()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7895,map,7894,map.totalSize()); for (int i = 0 ; i < (list.size()) ; i++) { fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7897,map,7896,map.containsKey(list.get(i).key)); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7899,map,7898,map.containsValue(list.get(i))); } fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
private void obtainLanguagesCacheTrans(List<LanguagesOutput> outputList, List<LanguagesInput> inputList) { if ((LanguagesInput.searchEngine(inputList, Engine.CACHETRANS.toString())) == -1) { return; } MultiValueMap langs = Cachetrans.getLanguages(); for (Object s : langs.keySet()) { for (Object t : langs.getCollection(s)) { addLanguagePair(outputList, s.toString(), t.toString(), Engine.CACHETRANS.toString()); } } return; }
/** * commons collectios 的实例代码 */ private void mapExamples() { // 多值 map,一个 key 对于多个值 MultiValueMap mvm = new MultiValueMap(); mvm.put("1", "one"); mvm.put("2", "two"); mvm.put("1", "three"); for (Iterator it = mvm.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Map.Entry) it.next(); Object key = entry.getKey(); Object value = entry.getValue(); out.println("key=" + key + "; value=" + value); } // 判断是否包含指定的 key value out.println(mvm.containsValue("1", "one")); // MultiValueMap 的 value 值是 Collection 类型。实际上是 arrayList //测试类型 out.println(mvm.get("1").getClass()); ArrayList<String> list = (ArrayList<String>) mvm.getCollection("1"); for (String s : list) out.println(s); }
public static void main(String[] args) { String INPUT_TEXT = "Hello World! Hello All! Hi World!"; // Parse text to words and index List<String> words = Arrays.asList(INPUT_TEXT.split(" ")); // Create Multimap MultiMap<String, Integer> multiMap = new MultiValueMap<String, Integer>(); // Fill Multimap int i = 0; for(String word: words) { multiMap.put(word, i); i++; } // Print all words System.out.println(multiMap); // print {Hi=[4], Hello=[0, 2], World!=[1, 5], All!=[3]} - in random orders // Print all unique words System.out.println(multiMap.keySet()); // print [Hi, Hello, World!, All!] - in random orders // Print all indexes System.out.println("Hello = " + multiMap.get("Hello")); // print [0, 2] System.out.println("World = " + multiMap.get("World!")); // print [1, 5] System.out.println("All = " + multiMap.get("All!")); // print [3] System.out.println("Hi = " + multiMap.get("Hi")); // print [4] System.out.println("Empty = " + multiMap.get("Empty")); // print null // Print count unique words System.out.println(multiMap.keySet().size()); //print 4 }
public static void main(String[] args) { String INPUT_TEXT = "Hello World! Hello All! Hi World!"; // Parse text to words and index List<String> words = Arrays.asList(INPUT_TEXT.split(" ")); // Create Multimap MultiMap<String, Integer> multiMap = MultiValueMap.multiValueMap(new LinkedHashMap<String, Set>(), LinkedHashSet.class); // Fill Multimap int i = 0; for(String word: words) { multiMap.put(word, i); i++; } // Print all words System.out.println(multiMap); // print {Hello=[0, 2], World!=[1, 5], All!=[3], Hi=[4]} - in predictable iteration order // Print all unique words System.out.println(multiMap.keySet()); // print [Hello, World!, All!, Hi] - in predictable iteration order // Print all indexes System.out.println("Hello = " + multiMap.get("Hello")); // print [0, 2] System.out.println("World = " + multiMap.get("World!")); // print [1, 5] System.out.println("All = " + multiMap.get("All!")); // print [3] System.out.println("Hi = " + multiMap.get("Hi")); // print [4] System.out.println("Empty = " + multiMap.get("Empty")); // print null // Print count unique words System.out.println(multiMap.keySet().size()); //print 4 }
public static void main(String[] args) { String INPUT_TEXT = "Hello World! Hello All! Hi World!"; // Parse text to words and index List<String> words = Arrays.asList(INPUT_TEXT.split(" ")); // Create Multimap MultiMap<String, Integer> multiMap = MultiValueMap.multiValueMap(new TreeMap<String, Set>(), TreeSet.class); // Fill Multimap int i = 0; for(String word: words) { multiMap.put(word, i); i++; } // Print all words System.out.println(multiMap); // print {All!=[3], Hello=[0, 2], Hi=[4], World!=[1, 5]} -in natural order // Print all unique words System.out.println(multiMap.keySet()); // print [All!, Hello, Hi, World!] in natural order // Print all indexes System.out.println("Hello = " + multiMap.get("Hello")); // print [0, 2] System.out.println("World = " + multiMap.get("World!")); // print [1, 5] System.out.println("All = " + multiMap.get("All!")); // print [3] System.out.println("Hi = " + multiMap.get("Hi")); // print [4] System.out.println("Empty = " + multiMap.get("Empty")); // print null // Print count unique words System.out.println(multiMap.keySet().size()); //print 4 }
public static void main(String[] args) { String INPUT_TEXT = "Hello World! Hello All! Hi World!"; // Разберем текст на слова и индексы List<String> words = Arrays.asList(INPUT_TEXT.split(" ")); // Создаем Multimap MultiMap<String, Integer> multiMap = new MultiValueMap<String, Integer>(); // Заполним Multimap int i = 0; for(String word: words) { multiMap.put(word, i); i++; } // Выводим все вхождения слов в текст System.out.println(multiMap); // напечатает {Hi=[4], Hello=[0, 2], World!=[1, 5], All!=[3]} - в произвольном порядке // Выводим все уникальные слова System.out.println(multiMap.keySet()); // напечатает [Hi, Hello, World!, All!] - в произвольном порядке // Выводим все индексы вхождения слова в текст System.out.println("Hello = " + multiMap.get("Hello")); // напечатает [0, 2] System.out.println("World = " + multiMap.get("World!")); // напечатает [1, 5] System.out.println("All = " + multiMap.get("All!")); // напечатает [3] System.out.println("Hi = " + multiMap.get("Hi")); // напечатает [4] System.out.println("Empty = " + multiMap.get("Empty")); // напечатает null // Выводим общее количество всех уникальных слов System.out.println(multiMap.keySet().size()); //напечатает 4 }
public static void main(String[] args) { String INPUT_TEXT = "Hello World! Hello All! Hi World!"; // Разберем текст на слова и индексы List<String> words = Arrays.asList(INPUT_TEXT.split(" ")); // Создаем Multimap MultiMap<String, Integer> multiMap = MultiValueMap.multiValueMap(new LinkedHashMap<String, Set>(), LinkedHashSet.class); // Заполним Multimap int i = 0; for(String word: words) { multiMap.put(word, i); i++; } // Выводим все вхождения слов в текст System.out.println(multiMap); // напечатает {Hello=[0, 2], World!=[1, 5], All!=[3], Hi=[4]} - в порядке добавления // Выводим все уникальные слова System.out.println(multiMap.keySet()); // напечатает [Hello, World!, All!, Hi] - в порядке добавления // Выводим все индексы вхождения слова в текст System.out.println("Hello = " + multiMap.get("Hello")); // напечатает [0, 2] System.out.println("World = " + multiMap.get("World!")); // напечатает [1, 5] System.out.println("All = " + multiMap.get("All!")); // напечатает [3] System.out.println("Hi = " + multiMap.get("Hi")); // напечатает [4] System.out.println("Empty = " + multiMap.get("Empty")); // напечатает null // Выводим общее количество всех уникальных слов System.out.println(multiMap.keySet().size()); //напечатает 4 }
public static void main(String[] args) { String INPUT_TEXT = "Hello World! Hello All! Hi World!"; // Разберем текст на слова и индексы List<String> words = Arrays.asList(INPUT_TEXT.split(" ")); // Создаем Multimap MultiMap<String, Integer> multiMap = MultiValueMap.multiValueMap(new TreeMap<String, Set>(), TreeSet.class); // Заполним Multimap int i = 0; for(String word: words) { multiMap.put(word, i); i++; } // Выводим все вхождения слов в текст System.out.println(multiMap); // напечатает {All!=[3], Hello=[0, 2], Hi=[4], World!=[1, 5]} -в натуральном порядке // Выводим все уникальные слова System.out.println(multiMap.keySet()); // напечатает [All!, Hello, Hi, World!] в натуральном порядке // Выводим все индексы вхождения слова в текст System.out.println("Hello = " + multiMap.get("Hello")); // напечатает [0, 2] System.out.println("World = " + multiMap.get("World!")); // напечатает [1, 5] System.out.println("All = " + multiMap.get("All!")); // напечатает [3] System.out.println("Hi = " + multiMap.get("Hi")); // напечатает [4] System.out.println("Empty = " + multiMap.get("Empty")); // напечатает null // Выводим общее количество всех уникальных слов System.out.println(multiMap.keySet().size()); //напечатает 4 }
public UnkLexicon(String filename) { MultiValueMap<String, String>[] entries = read(filename);//inserting unk here not working. //lexentriesTree = makeLextrees(entries[0], "ARG"); //lexentriesTree.putAll(makeLextrees(entries[1], "MOD")); lexEntriesTree = makeLexStrings(entries[0], "ARG");//need to fix makeLexStrings for UNK lexEntriesTree.putAll(makeLexStrings(entries[1], "MOD")); }
public void addAnalysis(String id, StringTreeAnalysis stringTree) { if (analyses == null) { analyses = new MultiValueMap<String, StringTreeAnalysis>();//<String, StringTreeAnalysis> } analyses.put(id, stringTree); }