Questions tagged [parsing]

Questions about built-in/custom parsers or parsing techniques.

Filter by
Sorted by
Tagged with
0 votes
0 answers
75 views

Parsing of WL code

Upon opening a .wl file someone send me I noticed that about 20 seconds were spend parsing the file. Sometimes it spends less time doing so for much bigger files. Upon looking up the term "...
user avatar
  • 1,032
1 vote
2 answers
64 views

Parsing data from site

I try parse hub titles and links from this site: https://habr.com/en/hubs/, but code returns empty list. Can not understand why. ...
user avatar
2 votes
0 answers
172 views

Input subscripts in Wolfram Cloud

I would like to input "rendered" subscripts in Wolfram Cloud, without having to verbosely type Subscript[a, b]. The local notebook shortcut is ...
user avatar
3 votes
2 answers
158 views

Custom bracket parser

I have a function $F$ taking arbitrarily many arguments from ${a,c,z}$ where practically (technically it isn't) $a$ works as an opening bracket and $z$ as a closing. ($c$ stands for a value.) Double ...
user avatar
17 votes
2 answers
378 views

How to create a CLI for Wolfram language scripts?

Former question: How to use wolframscript to develop flexible command-line tools? I am currently changing a notebook into a wolframscript for a "production" environment, where I plan to ...
user avatar
  • 668
16 votes
1 answer
457 views

How can I ingest and analyze benchmark results posted at MSE?

How can I ingest Mathematica / WL benchmark results posted at Mathematica Stack Exchange (MSE), like the ones posted here? Assumptions: There are multiple answers with benchmarks posted The ...
user avatar
1 vote
0 answers
32 views

Distinguishing function calls from multiplication when importing LaTeX via ToExpression and TeXForm

I'm trying to parse a LaTeX representation of a Desmos calculator (like this one) via Mathematica. Desmos exposes a JSON representation of its calculators, including a LaTeX representation of ...
user avatar
  • 111
1 vote
1 answer
61 views

Parse coefficients from a Resolve output

I have a huge output from Resolve (quantifier elimination) that I must parse to extract the coefficients as numbers. Take for instance something that looks like ...
user avatar
  • 85
1 vote
2 answers
179 views

How to extract data and attribute data from an XMLElement

I am trying to write a function to extract both the data and the attribute data from an XMLElement in the same pass. I have followed the examples from Mathematica's Transforming XML tutorial and the ...
user avatar
  • 187
2 votes
1 answer
166 views

Reading information from a Portable Executable (.exe)

I want to extract information from executable files, such as the names and sizes of sections, symbols, etc. The Wikipedia article has a diagram showing the layout of a PE. See also this diagram It ...
user avatar
  • 20.5k
6 votes
4 answers
506 views

What is the best way to parse differential equations and boundary conditions to a custom function?

I have written a method to turn systems of linear differential equations into matrix equations (discretisation). This handles boundary conditions using the row replacement method. At the moment, I ...
user avatar
  • 453
9 votes
2 answers
314 views

Removing banal words from a list

NB: I am aware of the DeleteStopwords symbol. I want to remove from a list of words the ones that are likely to be more banal. So for instance if we have ...
user avatar
  • 1,558
13 votes
2 answers
190 views

Repeated string pattern: difference between the FrontEnd and WolframScript?

This code works fine in a string based interface like WolframScript or Mathematica Kernel. Run this through a string based interface ...
user avatar
  • 36.9k
4 votes
3 answers
100 views

Subsequence Search

I need to parse some xml code. I need to extract some values withing pattern elements. I made an example of my trouble. Here is some complicated xml list: ...
user avatar
3 votes
0 answers
125 views

Slight loss of precision when parsing JSON

Exporting to JSON is working well for me under 11.3. The issue present in previous versions seem to be solved: ...
user avatar
11 votes
1 answer
173 views

Lexical scanning and parsing in a toy language

I'm trying to do lexical scanning and parsing in a toy language. One with just functions (of the form $f(a,\,b,\,c,\,...)$, ended with semicolons) and special tokens (such as ...
user avatar
  • 3,574
2 votes
0 answers
60 views

Confusing behavior for GrammarRules and GrammarApply

I have been experimenting with GrammarRules in an attempt to create a parser for text downloaded from the web. I have been using Interpreter to help understand the behavior of GrammarApply. Here is a ...
user avatar
11 votes
1 answer
100 views

Precedence of cell group tokens over package's expressions

Bug introduced in V10.4 or earlier and persisting through V11.3 [CASE:4072996] ...
user avatar
  • 133k
9 votes
4 answers
2k views

How to convert a string having nested parentheses into an expression?

I am a Wolfram Language/Mathematica beginner and trying to convert STEP ISO10303 commands into geometrical regions. A simple command looks like ...
user avatar
5 votes
1 answer
939 views

How to determine if RHS of first order ODE is separable or linear or neither? Parsing problem

Introduction This is really a parsing question. But the context is that given the right side of first order ode, I want to automatically determine the class of the RHS. It can be either separable, ...
user avatar
  • 113k
20 votes
1 answer
397 views

Is building an event-based parser possible/reasonable in Mathematica (WL)?

Too long? Go to Problems section Background I like to learn by doing small, sometimes artificial, projects. Among other things I had 'parsers', and 'stream methods / streams in MMA' on my to learn ...
user avatar
  • 133k
7 votes
2 answers
371 views

Getting the front sign of an expression. Positive or negative for formatting only

This is for the purpose of generating a string (actually it will Latex string, but that is not important). I need to generate string as ...
user avatar
  • 113k
6 votes
1 answer
65 views

Can we make preread replacements in an *.m* file before being run?

This the second question of (152743), the preamble of which is reproduced here: Those who don't have/prefer the front end of Mathematica will either use a plain ASCII editor to write a script in an <...
user avatar
  • 19.1k
5 votes
1 answer
75 views

Can we make new definitions for InputForm in packages?

Those who don't have/prefer the front end of Mathematica will either use a plain ASCII editor to write a script in an .m file or just use Mathematica directly from ...
user avatar
  • 19.1k
1 vote
0 answers
92 views

Scraping XML Paragraphs with URLs

I've been working on scraping an article from CNBC. The link is here I want to scrape the main body, and the code I have so far is this: ...
user avatar
1 vote
1 answer
187 views

Ugly Gaussian symbolic integration, how to extract coefficients and exponent argument?

I have a very ugly function with 157 terms that I want to integrate over three variables. Each term is a Gaussian integral in those variables multiplied by a polynomial in the variables. However, in ...
user avatar
  • 163
3 votes
1 answer
482 views

Pulling Out Values from JSON Association

Having a bit of trouble pulling a value out of a JSON Association here. I am scraping this website: http://www.msn.com/en-us/money/stockdetails/history/fi-126.1.BY.NYS I want to scrape the closing ...
user avatar
0 votes
0 answers
412 views

HTTP Status Code 403

I'm working with some scraping and have run into a bit of a problem. The website I am scraping is this: https://seekingalpha.com/symbol/CRM/stocktalks I am essentially trying to scrape the "stock ...
user avatar
1 vote
1 answer
80 views

Extracting Certain Areas of JSON

I've been working with some web scraping and have run into a wall. The website I'm working with is this: https://seekingalpha.com/symbol/TWLO/stocktalks I am trying to scrape all of the "stock talks" ...
user avatar
2 votes
1 answer
467 views

Parsing and Extracting XML Content

I've run into a little question while trying to parse XML. This seems like a rather simple task, but for the life of me I cannot figure it out. I pull up the XML of the website using the following ...
user avatar
2 votes
2 answers
509 views

Parse command line arguments

I have been trying to parse command line arguments. There are a couple of types of options. 1. Mandatory 2. Optional 3. Alternative There are built-in/3rd ...
user avatar
  • 3,092
6 votes
0 answers
91 views

Infix non-ASCII operator needs a space to be parsed correctly in a script

Bug introduced in 9.0 or earlier and persisting through 11.1 First off: ...
user avatar
  • 8,584
8 votes
3 answers
2k views

How to parse JSON

please forgive me if this is obvious, but I have some JSON: ...
user avatar
  • 407
3 votes
0 answers
37 views

Unexpected behaviour with WordSeparators and Read [duplicate]

I am confused about how Read separates elements. The following all work fine: ...
user avatar
  • 227k
5 votes
1 answer
198 views

Context inside Do[...]-loop

Consider the following code: Begin["mycontext`"]; myvar = 7; Print[Context[]]; Print[Context[myvar]]; End[]; with the output mycontext` mycontext` Now ...
user avatar
  • 517
3 votes
2 answers
889 views

Reading a text file and parsing only the text between two delimiters

How are you? I'm a chemist with almost no experience with Mathematica, but I'm thinking of using it as a tool for my Ph.D in Computational Chemistry. My Quantum Chemistry software (ORCA) generates a ...
user avatar
  • 193
1 vote
2 answers
199 views

How is a single tilde parsed?

How is a~b parsed and evaluated? I would expect an error, but it goes through without any complaints, yielding no apparent output. At first I thought it evaluated ...
user avatar
  • 3,393
4 votes
1 answer
73 views

How do I import a Dataset that contains lists?

The very first example in the Dataset documentation is the following: ...
user avatar
3 votes
1 answer
110 views

How to use MakeExpression for single characters

Here is code that I thought would make the front end parse f as BigFunction: ...
user avatar
  • 19.1k
11 votes
4 answers
2k views

How to get the longest bracket pairs from a string

In C#, we can use regular expression to do some balancing groups, like we can get {<aa <bbb> <bbb> aa>, <<dfa>a>} from ...
user avatar
  • 24.6k
19 votes
4 answers
866 views

Is it important that the front-end has a built-in parser?

The Notebook interface has a parser that seems aware of all operator-precedences, allowing us to step through the expressions (rather: Box-) hierarchy with Ctrl+. This is extremely convenient, saving ...
user avatar
  • 5,619
6 votes
1 answer
74 views

Can Read[] apply a custom function automatically to the read values?

Read[stream, Number] will return a single read number. We can use a number of standard, documented types instead of Number, ...
user avatar
  • 227k
3 votes
0 answers
190 views

SymbolicC/SymbolicCUDAFunction generating C/C++ parser?

I wish to do some program transformation and analysis. Is there any package that generates SymbolicC expressions from C code? In a sense I'm looking for the ...
user avatar
  • 5,619
3 votes
1 answer
103 views

How to speed up accidental large output?

From time to time I accidentally let large expressions like RandomReal[1., {10^5, 10, 10}] reach the front end. The computation of the result is quite fast (...
user avatar
  • 5,619
10 votes
1 answer
303 views

Why is this syntax for patterns with Optional values not supported?

I want to express Optional[PatternTest[Pattern[a,Blank[]],t],1] concisely. a : _?t : 1 is not quite this but works: ...
user avatar
  • 5,619
6 votes
0 answers
101 views

Weird bug with Esc, string, and underscore? [closed]

There seems to be a bug with esc key, strings, and underscores. For instance, see the following code: a = f["1_2"]; If an esc character is typed anywhere ...
user avatar
  • 4,604
1 vote
2 answers
113 views

Use cases to exclude data values over a certain threshold

I am trying to parse data output from a fluorometer. My output is basically signal intensity over time. So I have a list of 2 value lists with the first value time and the second signal e.g., ...
user avatar
  • 43
9 votes
2 answers
291 views

FullForm with context for each symbol?

FullForm strips the context for any symbol that can be found on the Append[$ContextPath, $Context]: ...
user avatar
  • 5,619
0 votes
1 answer
212 views

How to read a part of huge matrix saved in a TXT file as single expression?

I saved a huge matrix of numbers with dimensions {400, 4001, 2} using Put and got a TXT file formatted in the following way: <...
user avatar
  • 41
7 votes
1 answer
314 views

How to get "one Cell - one line" code format inside of NB files?

The PageWidth option controls the way the Cell's content is displayed, not the manner it's written in a ...
user avatar