Refactoring, changes to API

Refactored the GraphManager class. The training endpoint now accepts
either a string or an array of strings for the “text” property.