Live data from Hacker News

The entire US Code is now online in XML

uscodebeta.house.gov

131–140 of 244 posts

Re: The entire US Code is now online in XML

#132
post #105

Earlier quoted context omitted.

You make this sound like a bad thing. Would you really prefer "black and white" laws that leave zero room for flexibility or interpretation in light of a given situation?

Yes, we should have black and white laws, and unit tests for them. So someone could write a unit test for "Will this allow the NSA to create a secret court that is outside the rule of law?" or "Does accessing a university computer that has an open access policy allow for a sentence of 130 years?" I believe we'd see a lot simpler laws.

I'd love to see this for a subset of laws. You could start with the law surrounding permits, for example.

Re: The entire US Code is now online in XML

#133

Earlier quoted context omitted.

> Since it's aimed at line-oriented code, it does line-based diffs You can do word diffs with git: git diff --word-diff=color

It's still recreating a word based diff from a line based diff. See diff.c line 793 for how it works.

It may be doing that conversion, but the conversion works. For example, committing the following text (with line breaks), then joining it all into one line, shows no differences when using 'git diff --word-diff'.

  Test the first. This will check if reflowing
  text actually produces git word-diff weirdness,
  or if it's actually decent.
The line does get reproduced on the terminal (a line diff was seen), but no text is shown in green or red to indicate an actual change.

Re: The entire US Code is now online in XML

#134

Earlier quoted context omitted.

It's still recreating a word based diff from a line based diff. See diff.c line 793 for how it works.

It may be doing that conversion, but the conversion works. For example, committing the following text (with line breaks), then joining it all into one line, shows no differences when using 'git diff --word-diff'. Test the first. This will check if reflowing text actually produces git word-diff weirdness, or if it's actually decent. The line does get reproduced on the terminal (a line diff was seen), but no text is sh…

Just checked with the old and new versions of Title_09.txt and you're right, --word-diff does the right thing. It echoes all the changed lines to the terminal, but it only marks up (and colors, in color mode) the changed words:

          [-Section 2 of act-]{+Act+} July 30, 1947, ch. 392, {+Sec. 2,+} 61 Stat. 674, provided that
Wonder if there's a way to enable that behavior on GitHub? And/or to generate repository activity statistics based on changed words rather than changed lines?

Re: The entire US Code is now online in XML

#135
post #101

Earlier quoted context omitted.

Remember that diff is an algorithm to generate the smallest set of operations to produce version B from version A, not an accurate reconstruction of what happened. Diff algorithms are also often tuned not try as hard to find the smallest set of changes for larger documents, due to speed concerns.

Git's built-in diff algorithm is particularly bad for text. Since it's aimed at line-oriented code, it does line-based diffs, which is horrible for ASCII text that is reflowed, because every line in a paragraph will show up as changed for a small change. Example: https://github.com/divegeek/uscode/commit/1fb2d83137dad1c6ca... What's happened is that "Section 2" was moved later in the sentence, abbreviated as "Sec. 2"…

If there are sporadic line differences, for that git diff supports different algorithms than the default. patience or histogram may work better.

as far as words in lines, you do have a point.

Re: The entire US Code is now online in XML

#136

Caveat for for many of us overly rational thinkers: the powers that be deliberately are allowed to 'interpret' this code nondeterministically by many different means including its 'spirit,' admissibility of relevant information, manipulation of venue and participants, apparently even extrajudicial proceedings lately. In short, that allows a lawyer to answer almost any question with "it depends," and start billing.

HN's InclinedPlane put this sad reality of the legal system into perspective wonderfully: http://news.ycombinator.com/item?id=4753117

Re: The entire US Code is now online in XML

#137
post #116
post #87

Earlier quoted context omitted.

It would be even awesome-er (and more useful) if you could parse individual bills and amendments into diffs, which get merged into 'master' as they become law. I'd love to `git blame` the U.S. code.

But that only works at the shallow level. A crook can get around that by asking/bribing/convincing someone else to be the one who's responsible for the amenment.

There is very little outright corruption in Congress. Special interests exert most of the influence through campaign contributions that are publicly disclosed. Larry Lessig has a great book on this: http://www.amazon.com/Republic-Lost-Corrupts-Congress---eboo.... And here is the link to his TED talk on the same topic: http://www.youtube.com/watch?v=mw2z9lV3W1g

Re: The entire US Code is now online in XML

#138
post #118

If you were to start a new country, what would the legislative process look like there? For example, how should new "startup nations" like BlueSeed ( http://blueseed.co ) inspired by Seasteading Institute go about passing and storing laws? Should they have some sort of open github repo to which anyone can make pull requests? How do you see the congress of the future?

Usually countries inherit the laws from the country they are decended from.

True, but what would it look like in the future? Would you just fork a repo?

Re: The entire US Code is now online in XML

#139
I find it amusing that here in Germany, we have that for years:

http://www.gesetze-im-internet.de/

All laws are available in XML, HTML, PDF, etc. The site also provides an RSS feed.

In addition, some enthusiasts regularily download stuff from there and apply those to a Git repository:

https://github.com/bundestag/gesetze

That way, this repository contains not only the current laws, but also the history of how the laws developed!

For the Git repository, the XML version is not used directly, but converted to markdown. This produces very readable diffs:

https://github.com/bundestag/gesetze/commit/f90e8fc8eb20f081...

Wouldn't it be cool if we could finally manage our laws of filing pull requests?

Re: The entire US Code is now online in XML

#140
post #105

Earlier quoted context omitted.

You make this sound like a bad thing. Would you really prefer "black and white" laws that leave zero room for flexibility or interpretation in light of a given situation?

Yes, we should have black and white laws, and unit tests for them. So someone could write a unit test for "Will this allow the NSA to create a secret court that is outside the rule of law?" or "Does accessing a university computer that has an open access policy allow for a sentence of 130 years?" I believe we'd see a lot simpler laws.

There's a sub-area of AI, since about the 1970s, that does try to do that, but it's very much at the research level. Modeling even simple "common sense" things is notoriously hard for computers (commonsense reasoning seems to require a large amount of implicit background information), so it's not clear that easy to unit-test coincides well with a human notion of simplicity and predictability.

That's one reason that, in addition to being an interesting challenge domain for AI researchers, it's interesting to logicians, who aim to come up with logics and decision procedures that can capture what a decision procedure in law looks like (classical first-order logic and theorem-proving don't seem to model it well). The main short-term application is to reasoning-support systems that can suggest potentially winning arguments, point out obvious holes in draft arguments you were going to make, etc., sort of the legal analogue of medical diagnostic systems.

A classic paper from 1977: http://www.cs.rutgers.edu/~mccarty/research/hlr77.pdf

A more recent system aimed at interactive use: http://www.ai.rug.nl/~verheij/publications/pdf/ai2004.pdf

A book, albeit priced at the usual Springer price-point that assumes no non-library human will buy it: http://www.amazon.com/gp/product/3642064329/ref=as_li_ss_tl?...

Post reply on HN