Live data from Hacker News

Show HN: A tool that transforms your whole list with just one example

transformy.io

121–130 of 151 posts

Re: Show HN: A tool that transforms your whole list with just one example

#123
post #89

Earlier quoted context omitted.

Thanks for the clarification, they are similar but not the same. It looks like _sketching_ is more analogous to using Hindley-Milner for filling in gaps in an executable spec, where as Programming by Example infers code from data (examples). There is a wealth of interesting material referenced in http://web.media.mit.edu/~lieber/Your-Wish-Intro.html

Sketching is a superset of programming by example. In examples, you only get input/output pairs, which as this thread shows, infers frustratingly close but wrong programs. In sketching, the input and output can also includes partial programs (sketches), so you can mark what you like, tweak, etc, and it fills in the rest. Increasing usability, the fragments can be in different languages. For example, input can be simp…

Cool. I have been mulling what it would be like to have a semigraphical tool to generate SQL queries (Spark,Hive,VoltDB,etc) where the user would drive a keyboard applying operators over columns, rows and relations for mapping, filtering, joining. Like VIM plus ZPL and the goal is a statistical result over some range. Why can't prolog programs generate our programs? One of my query visualizations is an origami like structure where data is joined across a relation, something like an Explain Plan on Hollywoolsd.

By analogous, I meant more generally, using some partial knowledge about a program or spec to fill in missing pieces, not types specifically.

Nice to know folks are using these techniques to do real world tasks, I always thought something like this would be first used for cleaning data. Types, properties, sketches and examples.

Three levels of relatedness, https://vimeo.com/22606387

Re: Show HN: A tool that transforms your whole list with just one example

#124
post #9

Amongst other things this can be used for cleaning tables/lists from special characters, changing date formats and creating xml or json. Feedback and suggestions are very much welcome! We plan on adding a few more features soon as right now it is fairly basic but would like to hear some opinions and see if there's people out there that have a use for this.

This is really neat! Any chance this will be a cli tool or module/library? It doesn't seem to play will with something like this as an input: 3, Roberto/Carlos, soccer, Brazil 35, Roberto/Carlos Michael Jordan, baseball, USA 6, Roberto/Carlos James Lebron, basketball, USA 10, Roberto/Carlos Shinji Kagawa, soccer, Japan Format: 3, ROBERTO/CARLOS, soccer, Brazil Gives me: 3, ROBERTO/CARLOS, soccer, Brazil 35, ROBERTO/C…

I thought that a cli version might be useful too. The closest thing I have right now is sed/awk. Sed can do this kind of stuff but you have to specify a Regular Expression instead of a simple example. Because you have to be more specific about what you want, Sed will definitely handle those examples, with the caveat that you have to tell Sed what it is that you want to substitute and where for each line.

http://linux.die.net/abs-guide/x19673.html

It took me about a year of use before I could figure out how to munge lines in it, so it's definitely not for the faint of heart. I use it for things like transforming excel spreadsheets into C struct arrays.

Re: Show HN: A tool that transforms your whole list with just one example

#127
post #104

On your main screen, make the example editable. It would be nice to be able to just enter into the green box to see how it works rather than have to click through the "Get Started" Also, your instructions makes it seem like the example is editable: SUPER EASY TO USE 1. Paste your source data in the white box on the left. 2. Type in the green box on the right how you would like the first line of your data to look. 3.…

You're right that our instructions make it seem like the examples are editable. We'll work on that. Thanks for your feedback!

Re: Show HN: A tool that transforms your whole list with just one example

#128
post #50

This is a great idea! It didn't behave the way I expected with some URLs as input, though: http://example1.org/path/index.html http://www.example2.org/path/index.html http://www.example3.org/ https://www.example4.org/a/b/c/d/e/f/g/hijklmnop The pattern I gave was: example1.org, path/index.html So I expected to get: example1.org, path/index.html www.example2.org, path/index.html www.example3.org, www.example4.org, a/b…

I think it's trying to be too magical. At this point it either seems to work, or something triggers it's pattern matching wrong and it's really hard to figure out what or why. I think giving back a little of the simpleness in favor of more control is worthwhile. For example, if the example portions that were formatting were differentiated from the data matching, it's not too complicated but intent is much clearer.

For example, if the rules were: example content must be contained within braces, and any braces within the example content need to be escaped, it's clear. At that point, your example becomes:

  {example1.org}, {path/index.html}
It would still probably just return "wwwexample.4, g/hijklmnop" for the last example though, because it's ambiguous as to whether you want just the end of the url, or the whole thing. Allowing regex markup for more explicit matching would make it clearer still, but your example still causes problems until you go all the way to positive lookbehind assertions. At that point I need to learn all that, I might as well just use perl:

  # perl -pe 's{.*https?://([^/]+)(/\S*).*}{$1, $2}' /tmp/foo
  example1.org, /path/index.html
  www.example2.org, /path/index.html
  www.example3.org, /
  www.example4.org, /a/b/c/d/e/f/g/hijklmnop

Re: Show HN: A tool that transforms your whole list with just one example

#129
post #11

Afaik, "LeBron" is his first name. The way you use it (and misspell it) is confusing, I'd suggest you replace him with a simpler alternative (Kobe Bryant? Tim Duncan? whatever). Same for Kagawa -- the Japanese use surnames in a different way, might be simpler to replace him.

I don't follow basketball and really thought LeBron was his family name. Thanks!

Re: Show HN: A tool that transforms your whole list with just one example

#130
post #11

Afaik, "LeBron" is his first name. The way you use it (and misspell it) is confusing, I'd suggest you replace him with a simpler alternative (Kobe Bryant? Tim Duncan? whatever). Same for Kagawa -- the Japanese use surnames in a different way, might be simpler to replace him.

[deleted]
Post reply on HN