<commit_before># IBM Rapsody example

See:
  - https://www.reddit.com/r/Python/comments/4k50gf/textx_13_a_libtool_for_building_dsls_and_parsers/
  - http://stackoverflow.com/questions/36524566/pyparsing-recursion-of-values-list-ibm-rhapsody

Example taken from https://github.com/mansam/exploring-rhapsody/blob/master/LightSwitch/LightSwitch.rpy


To check and visualize meta-model and test model:

    $ textx visualize ibm_rapsody.tx test.ibmr
<commit_msg>Additional clarification in IBM Rapsody example<commit_after># IBM Rapsody example

See:
  - https://www.reddit.com/r/Python/comments/4k50gf/textx_13_a_libtool_for_building_dsls_and_parsers/
  - http://stackoverflow.com/questions/36524566/pyparsing-recursion-of-values-list-ibm-rhapsody

Example taken from https://github.com/mansam/exploring-rhapsody/blob/master/LightSwitch/LightSwitch.rpy


To check and visualize meta-model and test model:

    $ textx visualize ibm_rapsody.tx test.ibmr

Load from code:

    from textx.metamodel import metamodel_from_file

    meta = metamodel_from_file('ibm_raposody.tx')
    model = meta.model_from_file('test.ibmr')


`model` will be an instance of `IBMRapsodyModel` class described by the grammar.

    print(model.root.name)
    for key in model.root.keys:
      print(key.name, key.values)

{'fraction_non_alphanumeric': 0.09891808346213292, 'fraction_numerical': 0.02009273570324575, 'mean_word_length': 4.51063829787234, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1756786', 'n_tokens_mistral': 493, 'n_tokens_neox': 450, 'n_words': 81}