Made technical fixes to entity-related memories.

Changed formatting, added const qualifiers and use of references.
Changed memory storage use a map instead of element map
Created a MindProviderFactory to handle mind-related queries
Added MindProviderFactory tests
Changed parser to use an instance of a provider factory for segments

Modified the client code to comply to this change