Rule-based Natural Language Processing Algorithm