# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # Scripts to Models

import os
import sys 
sys.path.insert(0, os.path.abspath('..\..\..\sysmpy'))  
from sysmpy import *

# ## Requirement Generation

# +
text = "SAI should automatically optimize the spatial box arrangement."

# 1. Perform SystemModelExtractor
sp = SystemModelExtractor(text)
model_info = sp.run()
print(model_info)

# 2. Perform ModelGenerator for requirement
mg = ModelGenerator()
req = mg.to_requirement(model_info)
print(req)
# -

# ## Action Model Generation

# +

texts = ["System should automatically optimize the spatial box arrangement.",
         "System shall deliver three small products to each green level customer.",
         "System shall deliver two larger products to each gold level customer.",
         "System shall complete all product deliveries between 9PM Dec 24 and 6 AM Dec 25."]

# 1. Perform SystemModelExtractor
for t in texts:
    sp = SystemModelExtractor(t)
    model_info = sp.run()

    # 3. Perform ModelGenerator for action model
    mg = ModelGenerator()
    am = mg.to_action_model(model_info) 

# 2. covert the action model in the memory to an action model script
sg = ScriptGenerator()
script = sg.run(am)
print(script)

show(am, width=150)

# -



StarcoderdataJupyterScriptsDedupFiltered