Hi there,
I am trying to work with Wolfram scripts (.wls) instead of notebook files (.nb), to increase Git compatibility.
I am able to enter free-form inputs normally with "CTRL" + "=". The cell does not have the same display as in notebooks, but it works as expected. However, if I save the file and close it, on the next time I open it I have the following problems:
the free-form input is substituted by a long expression: NamespaceBox["LinguisticAssistant",DynamicModuleBox[{Typeset`query$$="number of turkeys in Turkey",Typeset`boxes$$=RowBox[{TemplateBox[{"\"Turkey\"",RowBox[{"Entity","[",RowBox[{"\"Country\"",",","\"Turkey\""}],"]"}],"\"Entity[\\\"Country\\\", \\\"Turkey\\\"]\"","\"country\""},"Entity"],"[",InterpretationBox[DynamicModuleBox[{EntityFramework`Formatting`Private`open=False},TemplateBox[{TemplateBox[{"\"livestock population\""},"ImplicitEntityPropertyBase"],TagBox[GridBox[{{TemplateBox[{RowBox[{" ","\"FAOLivestockType\""}],"\":\"","\"turkeys\""},"ImplicitEntityInfoRow"]}},GridBoxAlignment->{"Columns"->{{Left}}},DefaultBaseStyle->"GeneralizedEntityInfoGrid",GridBoxItemSize->{"Columns"->{{Automatic}},"Rows"->{{Automatic}}},GridBoxSpacings->{"Columns"->{{Automatic}},"Rows"->{{Automatic}}}],"Column"],Dynamic[EntityFramework`Formatting`Private`open],"\"EntityProperty[\\\"Country\\\", \\\"LivestockPopulation\\\", {\\\"FAOLivestockType\\\" -> \\\"Turkeys\\\"}]\"",TemplateBox[{"\"turkeys\""},"ImplicitEntityPropertySequence"]},"ImplicitEntityPropertyToggle"]],EntityProperty["Country","LivestockPopulation",{"FAOLivestockType"->"Turkeys"}],SelectWithContents->True],"]"}],Typeset`allassumptions$$={},Typeset`assumptions$$={},Typeset`open$$={1},Typeset`querystate$$={"Online"->True,"Allowed"->True,"mparse.jsp"->2.285885`6.810599371295524,"Messages"->{}}},DynamicBox[ToBoxes[AlphaIntegration`LinguisticAssistantBoxes["",4,Automatic,Dynamic[Typeset`query$$],Dynamic[Typeset`boxes$$],Dynamic[Typeset`allassumptions$$],Dynamic[Typeset`assumptions$$],Dynamic[Typeset`open$$],Dynamic[Typeset`querystate$$]],StandardForm],ImageSizeCache->{184.,{7.,16.}},TrackedSymbols:>{Typeset`query$$,Typeset`boxes$$,Typeset`allassumptions$$,Typeset`assumptions$$,Typeset`open$$,Typeset`querystate$$}],DynamicModuleValues:>{},UndoTrackedVariables:>{Typeset`open$$}],BaseStyle->{"Deploy"},DeleteWithContents->True,Editable->False,SelectWithContents->True]
the substituted code does not work anymore, instead just outputting the full input: NamespaceBox["LinguisticAssistant",
DynamicModuleBox[{Typeset`query$$ = "number of turkeys in Turkey",
Typeset`boxes$$ =
RowBox[{TemplateBox[{"\"Turkey\"",
RowBox[{"Entity", "[",
RowBox[{"\"Country\"", ",", "\"Turkey\""}], "]"}],
"\"Entity[\\\"Country\\\", \\\"Turkey\\\"]\"", "\"country\""},
"Entity"], "[",
InterpretationBox[
DynamicModuleBox[{EntityFramework`Formatting`Private`open =
False}, TemplateBox[{TemplateBox[{"\"livestock \
population\""}, "ImplicitEntityPropertyBase"],
TagBox[GridBox[{{TemplateBox[{RowBox[{" ",
"\"FAOLivestockType\""}], "\":\"", "\"turkeys\""},
"ImplicitEntityInfoRow"]}},
GridBoxAlignment -> {"Columns" -> {{Left}}},
DefaultBaseStyle -> "GeneralizedEntityInfoGrid",
GridBoxItemSize -> {"Columns" -> {{Automatic}},
"Rows" -> {{Automatic}}},
GridBoxSpacings -> {"Columns" -> {{Automatic}},
"Rows" -> {{Automatic}}}], "Column"],
Dynamic[EntityFramework`Formatting`Private`open],
"\"EntityProperty[\\\"Country\\\", \
\\\"LivestockPopulation\\\", {\\\"FAOLivestockType\\\" -> \\\"Turkeys\
\\\"}]\"",
TemplateBox[{"\"turkeys\""},
"ImplicitEntityPropertySequence"]},
"ImplicitEntityPropertyToggle"]], EntityProperty[
"Country", "LivestockPopulation", {
"FAOLivestockType" -> "Turkeys"}],
SelectWithContents -> True], "]"}],
Typeset`allassumptions$$ = {}, Typeset`assumptions$$ = {},
Typeset`open$$ = {1},
Typeset`querystate$$ = {"Online" -> True, "Allowed" -> True,
"mparse.jsp" -> 2.285885, "Messages" -> {}}},
DynamicBox[
ToBoxes[AlphaIntegration`LinguisticAssistantBoxes["", 4, Automatic,
Dynamic[Typeset`query$$], Dynamic[Typeset`boxes$$],
Dynamic[Typeset`allassumptions$$],
Dynamic[Typeset`assumptions$$], Dynamic[Typeset`open$$],
Dynamic[Typeset`querystate$$]], StandardForm],
ImageSizeCache -> {184., {7., 16.}},
TrackedSymbols :> {Typeset`query$$, Typeset`boxes$$,
Typeset`allassumptions$$, Typeset`assumptions$$, Typeset`open$$,
Typeset`querystate$$}], DynamicModuleValues :> {},
UndoTrackedVariables :> {Typeset`open$$}], BaseStyle -> {"Deploy"},
DeleteWithContents -> True, Editable -> False,
SelectWithContents -> True]
(Example from the Hands-on Start to Mathematica course.)
I know that using the SemanticInterpretation function would be a solution to write free-form text in .wls files that survive saving/closing/re-opening. However, I would like a way that allows me to use the "CTRL" + "=" shortcut.
Thank you,
EDIT: I have recently found out that the "CTRL" + "=" shortcut works fine if the whole expression is directly given to a variable, as in the example below ("orange-equal" is the free-form input equal sign).
turkeysInTurkey = "orange-equal" + "number of turkeys in Turkey"
It is strange that if the free-form input sign is the first character in the line instead, then that line cannot be saved in a script file.
|