Coder Social home page Coder Social logo

CSV/TSV Output about collatex HOT 6 CLOSED

interedition avatar interedition commented on July 23, 2024 1
CSV/TSV Output

from collatex.

Comments (6)

mhbeals avatar mhbeals commented on July 23, 2024 1

Yes, that was the idea. It would be a really helpful feature!

from collatex.

djbpitt avatar djbpitt commented on July 23, 2024

@mhbeals We're reviewing open issues and wondering whether you were still interested in this feature. If so, have I understood correctly that what you'd like is output similar to the alignment table, but with commas or tabs instead of the ASCII table borders? Thanks!

from collatex.

ebeshero avatar ebeshero commented on July 23, 2024

@djbpitt Observing from afar, the projects I'm involved in will benefit from this feature as well. I've recently been adapting collateX XML output with XSLT to produce output text with TSV to import into various spreadsheet formats. This facilitates fielding comments from team members about adjusting the algorithm and editing the output.

from collatex.

djbpitt avatar djbpitt commented on July 23, 2024

@mhbeals I've added an output type of "csv" at https://github.com/djbpitt/collatex/tree/csv ("csv" branch of my fork). The Python csv writer has some configuration options, listed at https://docs.python.org/3/library/csv.html#dialects-and-formatting-parameters, and I've left them all unspecified, that is, accepted the defaults. I'll add support for tsv once we've confirmed that csv is working correctly, but in the meanwhile, I would be grateful if you could please let me know whether it does what you want, and whether you think we should set any of the formatting parameters to any value other than the default.

To test, clone my fork of the collatex repo, cd to collatex/collatex-pythonport, temporarily uninstall your system version of collatex with pip uninstall collatex, check out the csv branch, and then run a test script, while you're located inside collatex/collatex-pythonport, either from a file or within a Jupyter Notebook. When I run:

%reload_ext autoreload
%autoreload 2
from collatex import *
collation = Collation()
collation.add_plain_witness("A", "The big gray koala")
collation.add_plain_witness("B", "The grey koala")
print(collate(collation, output="csv"))

the output is:

A,The ,big gray ,koala
B,The ,grey ,koala

from collatex.

djbpitt avatar djbpitt commented on July 23, 2024

@mhbeals I've just added a "tsv" output method to the "csv" branch of my fork, as well.

from collatex.

djbpitt avatar djbpitt commented on July 23, 2024

@mhbeals "csv" and "tsv" output methods have been included in CollateX Python 2.2.

from collatex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.