original_docstring: 
    Returns a dict where keys are nounElems (noun/id pairs) and the values are adjElem (adjective/id pair) lists.
  
    # "It has good speed, a nice perfect screen and keyboard."
    # We groped nameds e.g. {('SPEED', 4): [('SPEED', 4), ('SCREEN', 9), ('KEYBOARD', 11)], ('SCREEN', 9): [('SCREEN', 9)], ('KEYBOARD', 11): [('KEYBOARD', 11)]}
    # But, it would be wrong if we assign ('SPEED', 4) adjectives to all elem inside  [('SPEED', 4), ('SCREEN', 9), ('KEYBOARD', 11)] for example since these names being related does not mean they share the same adjective.
    
    # "It has good speed, a nice perfect screen and keyboard." In this sentence speed, screen and keyboard are related but screen and keyboard have different adjective qualifying themselves. If we assign speed's adjective(s) to them; they would all have 'good' as an adjective as well as their own adjectives like 'nice' and 'perfec' for screen. However, speed is qualified by good only and screen/keyboard are qualified by the same adjective 'nice'. But, how can we know keyboard is qualified by 'nice' but not 'good'? Since we know that 'nice' comes after 'good' and already qualifies another noun; then it means the names coming after 'nice' can only be qualified by 'nice' or adjectives coming after 'nice' if any. So, for list [('SPEED', 4), ('SCREEN', 9), ('KEYBOARD', 11)], we check the adjectives of ('SPEED', 4) in dep_dict and we find 'good' and assign it to ('SPEED', 4) key. Then, for ('SCREEN', 9) we check if ('SCREEN', 9) has any adjectives qualifying it and we find 'nice' and 'perfect' so we assign these to ('SCREEN', 9) key. Then, for ('KEYBOARD', 11), we see that no adjectives qualfying it; so check the nearest preceding adjective which is of ('SCREEN', 9)'s and the adjectives are 'nice' and 'perfect so we assign these adjectives to ('KEYBOARD', 11). 
  
    # In the end, we get: {('SPEED', 4): {('GOOD', 3)}, ('SCREEN', 9): {('NICE', 7), ('PERFECT', 8)}, ('KEYBOARD', 11): {('NICE', 7), ('PERFECT', 8)}}
    
docstring: Returns a dict where keys are nounElems (noun/id pairs) and the values are adjElem (adjective/id pair) lists.
  "It has good speed, a nice perfect screen and keyboard."
  We groped nameds e.g.
  
  "It has good speed, a nice perfect screen and keyboard." In this sentence speed, screen and keyboard are related but screen and keyboard have different adjective qualifying themselves.
  
  
docstring_tokens: Returns a dict where keys are nounElems ( noun / id pairs ) and the values are adjElem ( adjective / id pair ) lists . " It has good speed a nice perfect screen and keyboard . " We groped nameds e . g . " It has good speed a nice perfect screen and keyboard . " In this sentence speed screen and keyboard are related but screen and keyboard have different adjective qualifying themselves .
code: def _mapCorrectAdjectivesToNounGroups(dep_dict, nounGroups):
    '''
    Returns a dict where keys are nounElems (noun/id pairs) and the values are adjElem (adjective/id pair) lists.
  
    # "It has good speed, a nice perfect screen and keyboard."
    # We groped nameds e.g. {('SPEED', 4): [('SPEED', 4), ('SCREEN', 9), ('KEYBOARD', 11)], ('SCREEN', 9): [('SCREEN', 9)], ('KEYBOARD', 11): [('KEYBOARD', 11)]}
    # But, it would be wrong if we assign ('SPEED', 4) adjectives to all elem inside  [('SPEED', 4), ('SCREEN', 9), ('KEYBOARD', 11)] for example since these names being related does not mean they share the same adjective.
    
    # "It has good speed, a nice perfect screen and keyboard." In this sentence speed, screen and keyboard are related but screen and keyboard have different adjective qualifying themselves. If we assign speed's adjective(s) to them; they would all have 'good' as an adjective as well as their own adjectives like 'nice' and 'perfec' for screen. However, speed is qualified by good only and screen/keyboard are qualified by the same adjective 'nice'. But, how can we know keyboard is qualified by 'nice' but not 'good'? Since we know that 'nice' comes after 'good' and already qualifies another noun; then it means the names coming after 'nice' can only be qualified by 'nice' or adjectives coming after 'nice' if any. So, for list [('SPEED', 4), ('SCREEN', 9), ('KEYBOARD', 11)], we check the adjectives of ('SPEED', 4) in dep_dict and we find 'good' and assign it to ('SPEED', 4) key. Then, for ('SCREEN', 9) we check if ('SCREEN', 9) has any adjectives qualifying it and we find 'nice' and 'perfect' so we assign these to ('SCREEN', 9) key. Then, for ('KEYBOARD', 11), we see that no adjectives qualfying it; so check the nearest preceding adjective which is of ('SCREEN', 9)'s and the adjectives are 'nice' and 'perfect so we assign these adjectives to ('KEYBOARD', 11). 
  
    # In the end, we get: {('SPEED', 4): {('GOOD', 3)}, ('SCREEN', 9): {('NICE', 7), ('PERFECT', 8)}, ('KEYBOARD', 11): {('NICE', 7), ('PERFECT', 8)}}
    '''
    nameElem_adjList_dict = convert_to_nameElem_adjList(dep_dict) # extra
    retVal = {}
    for _, nameElemList in nounGroups.items():
      lastValidInd = -1
      for i, nameElem in enumerate(nameElemList):
        if nameElem in nameElem_adjList_dict: # this name already has adjectives qualifying it.
          lastValidInd = i
        if lastValidInd != -1:
          retVal.setdefault(nameElem, set()).update(nameElem_adjList_dict[ nameElemList[lastValidInd] ])
    
    return retVal
code_tokens: def _mapCorrectAdjectivesToNounGroups ( dep_dict , nounGroups ) : nameElem_adjList_dict = convert_to_nameElem_adjList ( dep_dict ) retVal = { } for _ , nameElemList in nounGroups . items ( ) : lastValidInd = - 1 for i , nameElem in enumerate ( nameElemList ) : if nameElem in nameElem_adjList_dict : lastValidInd = i if lastValidInd != - 1 : retVal . setdefault ( nameElem , set ( ) ) . update ( nameElem_adjList_dict [ nameElemList [ lastValidInd ] ] ) return retVal
short_docstring: Returns a dict where keys are nounElems (noun/id pairs) and the values are adjElem (adjective/id pair) lists.
short_docstring_tokens: Returns a dict where keys are nounElems ( noun / id pairs ) and the values are adjElem ( adjective / id pair ) lists .
comment: '''
    Returns a dict where keys are nounElems (noun/id pairs) and the values are adjElem (adjective/id pair) lists.
  
    # "It has good speed, a nice perfect screen and keyboard."
    # We groped nameds e.g. {('SPEED', 4): [('SPEED', 4), ('SCREEN', 9), ('KEYBOARD', 11)], ('SCREEN', 9): [('SCREEN', 9)], ('KEYBOARD', 11): [('KEYBOARD', 11)]}
    # But, it would be wrong if we assign ('SPEED', 4) adjectives to all elem inside  [('SPEED', 4), ('SCREEN', 9), ('KEYBOARD', 11)] for example since these names being related does not mean they share the same adjective.
    
    # "It has good speed, a nice perfect screen and keyboard." In this sentence speed, screen and keyboard are related but screen and keyboard have different adjective qualifying themselves. If we assign speed's adjective(s) to them; they would all have 'good' as an adjective as well as their own adjectives like 'nice' and 'perfec' for screen. However, speed is qualified by good only and screen/keyboard are qualified by the same adjective 'nice'. But, how can we know keyboard is qualified by 'nice' but not 'good'? Since we know that 'nice' comes after 'good' and already qualifies another noun; then it means the names coming after 'nice' can only be qualified by 'nice' or adjectives coming after 'nice' if any. So, for list [('SPEED', 4), ('SCREEN', 9), ('KEYBOARD', 11)], we check the adjectives of ('SPEED', 4) in dep_dict and we find 'good' and assign it to ('SPEED', 4) key. Then, for ('SCREEN', 9) we check if ('SCREEN', 9) has any adjectives qualifying it and we find 'nice' and 'perfect' so we assign these to ('SCREEN', 9) key. Then, for ('KEYBOARD', 11), we see that no adjectives qualfying it; so check the nearest preceding adjective which is of ('SCREEN', 9)'s and the adjectives are 'nice' and 'perfect so we assign these adjectives to ('KEYBOARD', 11). 
  
    # In the end, we get: {('SPEED', 4): {('GOOD', 3)}, ('SCREEN', 9): {('NICE', 7), ('PERFECT', 8)}, ('KEYBOARD', 11): {('NICE', 7), ('PERFECT', 8)}}
    '''$SEP$# extra$SEP$# this name already has adjectives qualifying it.