The function tries to locate the keyword in the keyword collection and tried to detect the nearest lexical base, when the keyword is not yet defined.