@ SuppressWarnings ( "unchecked" ) private void updateSemantics ( SemanticVector toUpdate , String cooccurringWord , TernaryVector iv ) { SemanticVector prevWordSemantics = getSemanticVector ( cooccurringWord ) ; Integer occurrences = wordToOccurrences . get ( cooccurringWord ) ; if ( occurrences == null ) occurrences = 0 ; double semanticWeight = 1d / ( Math . exp ( occurrences / historyDecayRate ) ) ; // The meaning is updated as a combination of the index vector and the // semantics, which is weighted by how many times the co-occurring word // has been seen. The semantics of frequently co-occurring words // receive less weight, i.e. the index vector is weighted more. add ( toUpdate , iv , impactRate * ( 1 - semanticWeight ) ) ; toUpdate . addVector ( prevWordSemantics , impactRate * semanticWeight ) ; }
Update the semantics using the weighed combination of the semantics of the co - occurring word and the provided index vector . Note that the index vector is provided so that the caller can permute it as necessary .