Questions tagged [parsing]

Parsing is the process of analysing a string of symbols, either in natural language or in computer languages, conforming to the rules of a formal grammar.

Filter by
Sorted by
Tagged with
2 votes
1 answer
60 views

Text splitter using Regular Expressions in Python

I have been provided a text splitter class that will take a text input and use re.sub to make replacements when matches are found and also splits sentences up and stores them in a list. I had an idea ...
user avatar
5 votes
0 answers
41 views

Menu Parser in C

This is a simple program that parses a menu specification and creates a menu tree. Why? I want to create a menu application, where the user can select an entry in the menu, and either a submenu can ...
user avatar
  • 151
0 votes
0 answers
22 views

I am building a container of differently typed variables with names for easy parsing and usage in Rust

I am new to Rust and trying to learn more about it. I want to have some kind of container that can store parameters (variables, values, constants) of varying types together with a name. This container ...
user avatar
  • 101
1 vote
2 answers
60 views

Reading 12-bit words from 32-bit stream

I have a device (ADC) that stores its samples in a 32-bit buffer and each sample is a 12-bit word : I needed an algorithm to read those samples to a container (say ...
user avatar
  • 771
2 votes
2 answers
81 views

Regex and pandas to read forecast sky condition string

DataFrame methods to parse the sky condition from a terminal aerodrome forecast. A line in a taf can report zero-eight cloud layers. Cloud layers are required in predominate lines, and optional in ...
user avatar
8 votes
2 answers
588 views

Markup Language Parser in C++

I'm new to C++ and decided to write a parser for a markup language. I chose org-mode because it seemed relatively straightforward. parsertest.cpp ...
user avatar
4 votes
1 answer
51 views

Python script for zlib decompression

I'm looking for feedback/improvement on code that I wrote. It's a function that scans a file for zlib headers and returns the header, offset, and decompressed data. In main, below the function, I use ...
user avatar
4 votes
1 answer
87 views

Parsing an IP routing report with half a million lines into a PANDAS dataframe

I have a file that has around 440K lines of data. I need to read these data and find the actual "table" in the text file. Part of the text file looks like this. ...
user avatar
2 votes
1 answer
92 views

Fetch CSV file into PANDAS and send report of Spotify statistics

I'm relatively new and self taught in Python. I've written this code which gets a CSV file from a website, plays around with the data then creates an email with information gleaned. I know this is too ...
user avatar
  • 23
3 votes
1 answer
96 views

Processing a binary file with buffer length tags

I am trying to process a very large binary file using MappedByteBuffer from java.nio package. This is how the data looks like in the file: ...
user avatar
  • 33
5 votes
0 answers
111 views

Parsing indented text into a tree structure in C#

My goal is to take an input stream (text file), and then parse it into a tree node based on each line's indentation. My rules are Lines can be indented using either tabs or spaces, but the file must ...
user avatar
4 votes
1 answer
144 views

Haskell: implementing Read for a custom dynamic value type

I'm using Haskell to interpret a dynamically-typed language. I have a sum type called Value which can represent some basic objects: ...
user avatar
  • 143
3 votes
1 answer
49 views

Quickly read numeric input

Do you have any criticisms or corrections or improvements? I need to read only numbers(and this numbers could be from 0 to 1000000) ...
user avatar
1 vote
2 answers
60 views

Function to read a file until next token

I've got this function which reads an entry until the next starting Token determined through a function, as the nature of the token is flexible. Usage: ...
user avatar
  • 449
9 votes
1 answer
863 views

Python script to analyse Apache log files

I am fairly new to Python programming language. Most of python programmers have heard the philosophy behind the python programming language. The code should be easy to read, easy to understand, simple,...
user avatar
2 votes
2 answers
77 views

Parse a string with titles and subitems to an object

I want to parse a string to an array of object with following those rules: parse line by line if line starts with "*" this is a title if line starts with "\s**" this is a ...
user avatar
  • 175
4 votes
1 answer
47 views

Awk program for extracting unique values from a k1=v1,k2=v2,... list

A single string consisting of comma-separated pairs in the format <key>=<value>, like ...
user avatar
1 vote
0 answers
42 views

Gemtext parser in JavaScript

Gemtext is a lightweight markup language designed to serve content over the Gemini protocol. You can learn more about the language here: A quick introduction to "gemtext" markup, or the ...
user avatar
  • 1,215
4 votes
0 answers
32 views

formatting flattened string into JSON-like object in C++, part 2

I have reworked the code from my previous (linked) post. For reference: I have a string which contains JSON-like object flattened (stringify()ed). I need to JSON-...
user avatar
2 votes
0 answers
54 views

Mini Scheme interpreter

Right now, I'm working on an interpreter for a subset of the Scheme programming language. It supports lambdas, let/let*/letrec, procedures, combinations, ...
user avatar
2 votes
1 answer
72 views

formatting flattened string into JSON-like object in C++

I have a string which contains JSON-like object flattened (stringify()ed). I need to JSON-ify it back. It's a custom format, so I wrote function to JSON-ify the ...
user avatar
0 votes
0 answers
35 views

Script to fix linkage done with #pragma comment(lib, "a.lib) for Visual Studio project

I have a legacy project that has a lot of linkage done using #pragma comment(lib, "libname.lib"). Moreover, some projects define linker directives in ...
user avatar
1 vote
1 answer
111 views

Better ways to parse the Content-Length from the HTTP header

I have a buffer that contains the HTTP header, which contains the Content-Length string indicating how big the file is that needs to be downloaded. I am looking to ...
user avatar
  • 147
3 votes
3 answers
119 views

Implementation of a Parser for Analysis Description Language

I have created a script for parsing ADL and the code looks like below. Example ADL file I am looking for suggestions to divide the code in multiple methods and make it more readable. Thanks ...
user avatar
  • 155
1 vote
1 answer
126 views

Boolean expression evaluation for user input using evil eval

The following code is a module that evaluates boolean expressions, which are entered through an unauthorized web API. The exposed function of the library being used is ...
user avatar
6 votes
1 answer
90 views

Lexer for a Scheme-like language in rust

I was/am working on an interpreter for a scheme-like language. Just some time back I shifted my implementation from C++ to Rust, which I just started learning. I know there are parser libraries like ...
user avatar
0 votes
2 answers
160 views

Good practices for parsing this text file

I have the following .txt file structure that i want to parse in Java(8): ...
user avatar
3 votes
2 answers
144 views

Parsing a std::string to a dictionary (std::map)

As always - the context ! Preliminaries Recently I needed a way to transport data from one environment to another. Though the proper way (probably) to do this would be to use databases (which I don't ...
user avatar
  • 771
3 votes
0 answers
61 views

Advent of Code 2021: day 10- Syntax Scoring

The following code solves day 10 in the advent of code challenge. The goal for this time around is evaluating whether a line of brackets is complete, has a syntax error or is missing some closing ...
user avatar
2 votes
1 answer
60 views

Parsing A Simple Matrix Definition In C

In one of my homework projects, I have to parse a matrix definition into a matrix data structure in C. The elements of the matrix will be given in a list of double. I need a simple tokenizer and ...
user avatar
  • 123
1 vote
1 answer
90 views

Parse a selection of date formats

This Bash program parses day, month, year and month and year from arguments: ...
user avatar
  • 173
6 votes
5 answers
283 views

Extracting a part of a URL path

I have a string like the one below from which I am extracting the tariff name. ...
user avatar
  • 63
3 votes
4 answers
262 views

Convert number 1-5 from its spelt-out form

I'm working with an API that for some strange reason returns star ratings as words, like FIVE,FOUR,THREE,TWO,ONE. As far as I can see, there's no way to just get ...
user avatar
  • 185
1 vote
1 answer
117 views

Python Fasta Parser using dictionaries without using BioPython or other external libraries

I am writing my own parser for fasta format. I can't use Biopython or anything else, because it's a part of an assigment and our teacher wants us to try to do it manually. For now, I have done this: <...
user avatar
3 votes
3 answers
426 views

Find the average score, given data in a table with labeled columns not in a fixed order

I was on Hacker Rank for the first time and there was a question that required to get the inputs from STDIN and use collections.namedtuple(). It was my first time ...
user avatar
  • 141
1 vote
1 answer
90 views

Parsing data from different file formats

While setting up applications to communicate between various different trade partners and our WMS software I often have to parse very similar information from various different file formats. In this ...
user avatar
  • 113
4 votes
2 answers
206 views

i3 config file parser

So I am using i3 an Linux window manager to manage my windows. In addition this is run on a laptop that is frequently mounted to several output-displays. This is handled by the following lines in my ...
user avatar
3 votes
1 answer
27 views

Bash argument parser with support for concatenated flags and '=' or ' ' between arguments and values

This is my best attempt so far at a bash script argument parser written without GNU getopt or bash getopts the first two ...
user avatar
  • 161
1 vote
1 answer
79 views

using pandas and numpy to parse dirty .csv

I'm relatively new to Python have been writing for a few months now. I've started a Pandas Numpy project that starts with parsing large and somewhat sloppy formatted textfile, its not exactly csv but ...
user avatar
3 votes
0 answers
66 views

Python program that analyzes a corpus for randomword generation

I play a lot of old-school western CRPGs, and most of them (if not all) require the player to generate an avatar at the start of a new game, including naming the character (with names that will never ...
user avatar
3 votes
3 answers
276 views

PHP fetch an automated email, parse text for specific data, store, send summary

I'm new here. I recently found myself in charge of a large PHP-based system. The guy that wrote it produced some of the worst code I've ever seen. I've never been in charge and have had the luxury of ...
user avatar
2 votes
3 answers
137 views

Optimize lexer/parser bottleneck in C++

I am writing a parser for a custom mesh format for fluid dynamics simulation library, the mesh file contains 3D points (vertices) for the simulation mesh, for example: ...
user avatar
  • 339
1 vote
2 answers
168 views

Parsing words from string

I am learning Java, so I am beginner. I know I can do this with split function but I want to improve my algorithm knowledge. I will be glad if you help me. Thanks. inputStr variable is contains the ...
user avatar
5 votes
1 answer
118 views

How could this indentation-based lexer be simplified?

I finally got this lexer working, full implementation here. How can the lex function be simplified? The goal is to take a tree of indentation-based text, and ...
user avatar
  • 299
5 votes
1 answer
99 views

Small combinator parsing library in Haskell

I recently wrote code to parse lambda expressions written in a lisp like format, using a small hand-rolled parsing library. The goal This code was written as a part of this code-golf challenge not as ...
user avatar
1 vote
2 answers
86 views

Function to skip characters

A very simple function that can be used such that it returns a pointer to the first character on which func returned 0. However, ...
user avatar
  • 1,353
4 votes
1 answer
59 views

Preprocessing invalid xml before feeding it to a parser

As part of a larger project I'm writing to learn C++, I'm trying to read through some almost-XML files generated by another program. Unfortunately this program uses its own custom escaping logic, so ...
user avatar
1 vote
0 answers
98 views

Yet another .ini parser for AutoHotKey

I decided to learn a little about AutoHotKey, to practice a little and learn about classes. I ended up writting a basic ini file parser. ...
user avatar
1 vote
2 answers
59 views

Extracting items from comma/semicolon-delimited strings, discarding parts after a hyphen

New Scala dev here. Is there a more idiomatic or efficient way to accomplish this in Scala? Given a list of the following strings, I need to obtain the unique 'main parts' once any parts including ...
user avatar
6 votes
1 answer
285 views

Parsing input and output currency names

The input for price() would be STRINGS, as you see below. If the string starts with "-" I would like what follows to be stored in fiat_name and then retrieve the symbol from ...
user avatar

1
2 3 4 5
26