Returns the index vector for the term, or if creates one if the term to
index vector mapping does not yet exist.

@param term a word in the semantic space

@return the index for the provide term.
543697
private TernaryVector getTermIndexVector(String term) {
        TernaryVector iv = termToIndexVector.get(term);
        if (iv == null) {
            // lock in case multiple threads attempt to add it at once
            synchronized(this) {
                // recheck in case another thread added it while we were waiting
                // for the lock
                iv = termToIndexVector.get(term);
                if (iv == null) {
                    // since this is a new term, also map it to its index for
                    // later look-up when the integer documents are processed
                    termToIndex.put(term, termIndexCounter++);
                    // next, map it to its reflective vector which will be
                    // filled in process space
                    termToReflectiveSemantics.put(term, createVector());
                    // last, create an index vector for the term
                    iv = indexVectorGenerator.generate();
                    termToIndexVector.put(term, iv);                    
                }
            }
        }
        return iv;
    }
758254
public static List<Term> getSubTerm(Term from, Term to) {
		
		List<Term> subTerm = new ArrayList<Term>(3);

		while ((from = from.to()) != to) {
			subTerm.add(from);
		}

		return subTerm;
	}
865349
public Vector query(String content)
    {
        if (content == null || content.length() == 0) return null;
        List<Term> termList = NotionalTokenizer.segment(content);
        Vector result = new Vector(dimension());
        int n = 0;
        for (Term term : termList)
        {
            Vector vector = wordVectorModel.vector(term.word);
            if (vector == null)
            {
                continue;
            }
            ++n;
            result.addToSelf(vector);
        }
        if (n == 0)
        {
            return null;
        }
        result.normalize();
        return result;
    }
1165015
public int getIndex(String feature)
	{
		//logger.debug("FeatureIndex.get : " + feature + "(" + count + ")");
		Integer index = (Integer) map.get(feature);

		if (index == null)
			return -1;

		return index.intValue();
	}
241434
@Override
    public String wordAtIndex(int index) {
        T element = idxMap.get(index);
        if (element != null) {
            return element.getLabel();
        }
        return null;
    }
997878
@Override
    public void addWordToIndex(int index, String label) {
        if (index >= 0) {
            T token = tokenFor(label);
            if (token != null) {
                idxMap.put(index, token);
                token.setIndex(index);
            }
        }
    }
171531
@Override
    public int wordFrequency(@NonNull String word) {
        // TODO: proper wordFrequency impl should return long, instead of int
        T element = extendedVocabulary.get(word);
        if (element != null)
            return (int) element.getElementFrequency();
        return 0;
    }
280028
public static int getFrequency(String word)
    {
        CoreDictionary.Attribute attribute = getAttribute(word);
        if (attribute == null) return 0;
        return attribute.totalFrequency;
    }
167679
public static int getPosition(Term subTerm, Term term) {
		int startingIndex = -1;
		int j = 0;
		for(int i=0; i<term.getWords().size(); i++) {
			if(term.getWords().get(i).equals(subTerm.getWords().get(j))) {
				j++;
				if(startingIndex == -1) 
					startingIndex = i;
			} else {
				startingIndex = -1;
				j = 0;
			}
			if(j == subTerm.getWords().size())
				return startingIndex;
		}
		return -1;
	}
1169337
public String[] getTags(String word) {
    if (caseSensitive) {
      return (String[]) dictionary.get(word);
    }
    else {
      //System.err.println(java.util.Arrays.asList((String[]) dictionary.get(word.toLowerCase())));
      return (String[]) dictionary.get(word.toLowerCase());
    }
  }
1169775
def _term(self, term):
        
        # All terms must be strings for Elasticsearch
        term = str(term)
        if term:
            self.__query["q"] += term
        return self
378928
public Vector getFeatureVector(Lexicon lexicon) {
		Parameters.WeightingMethod method = lexicon.getMethod();
		return getFeatureVector(lexicon, method, null);
	}
1242910
public static int getTermFrequency(String term)
    {
        Attribute attribute = get(term);
        if (attribute == null) return 0;
        return attribute.totalFrequency;
    }
846779
@Override
	public Collection<String> getSuggestions(String term) {

		List<String> suggestions = new ArrayList<>();
		for (Alternative alternative : getAlternatives(term)) {
			suggestions.add(alternative.getSuggestion());
		}
		return suggestions;
	}
207089
public IndexDef getIndex(String name)
    {
        String   realName = (name == null ? "" : name);
        IndexDef def      = null;

        for (Iterator it = getIndices(); it.hasNext();)
        {
            def = (IndexDef)it.next();
            if (def.getName().equals(realName))
            {
                return def;
            }
        }
        return null;
    }
266913
@Override
    public INDArray getWordVectors(@NonNull Collection<String> labels) {
        int indexes[] = new int[labels.size()];
        int cnt = 0;
        boolean useIndexUnknown = useUnknown && vocab.containsWord(getUNK());

        for (String label : labels) {
            if (vocab.containsWord(label)) {
                indexes[cnt] = vocab.indexOf(label);
            } else
                indexes[cnt] = useIndexUnknown ? vocab.indexOf(getUNK()) : -1;
            cnt++;
        }

        while (ArrayUtils.contains(indexes, -1)) {
            indexes = ArrayUtils.removeElement(indexes, -1);
        }
        if (indexes.length == 0) {
                return Nd4j.empty(((InMemoryLookupTable)lookupTable).getSyn0().dataType());
        }

        INDArray result = Nd4j.pullRows(lookupTable.getWeights(), 1, indexes);
        return result;
    }
1105650
public int getIndex(String name) {
    Integer index = nameIndex.get(name);
    if (index == null) {
      throw new IllegalArgumentException("Field with name '" + name + "' was not found");
    }
    return index;
  }