1. An information processing apparatus comprising: a creation unit adapted to create a query string, which is composed of a plurality of queries; a reading unit adapted to perform reading of a query, which is corresponding to a hierarchy of a current node, from the query string; a generation unit adapted to generate a plurality of nodes having a tree structure by dividing a learning pattern set in the current node in accordance with the read query corresponding to the hierarchy; and a modifying unit adapted to modify the tree structure by putting nodes in each hierarchy together into a common node with respect to nodes up to a hierarchy corresponding to a length of the query string among the nodes having the tree structure, which have been generated by said generation unit.