freelawproject / eyecite

Find legal citations in any block of text
https://freelawproject.github.io/eyecite/
BSD 2-Clause "Simplified" License
123 stars 32 forks source link

get_citations alternating between reporters #106

Closed flooie closed 2 years ago

flooie commented 2 years ago

Eyecite is finding the wrong reporter for a citation - but alternating between the right and wrong.

When I run this code six times I get

citations_objs = eyecite.get_citations("2013 Ark. App. 459")
cite_type_str = citations_objs[0].exact_editions[0].reporter.cite_type
print(cite_type_str)
state
state
neutral
neutral 
state
neutral

This is confusing for me because I just updated reporters-db with the following reporter.

"Ark. App.": [
        {
            "cite_type": "state",
            "editions": {
                "Ark. App.": {
                    "end": "2008-12-31T00:00:00",
                    "regexes": [
                        "(?P<volume>\\d{1,3}) $reporter $page"
                    ],
                    "start": "1981-01-01T00:00:00"
                }
            },
            "examples": [
                "84 Ark. App. 412"
            ],
            "mlz_jurisdiction": [
                "us:ar;appeals.court"
            ],
            "name": "Arkansas Appellate Reports",
            "variations": {
                "Ak. App.": "Ark. App.",
                "Ark.App.": "Ark. App."
            }
        },
        {
            "cite_type": "neutral",
            "editions": {
                "Ark. App.": {
                    "end": null,
                    "regexes": [
                        "$volume_year $reporter $page"
                    ],
                    "start": "2009-01-01T00:00:00"
                }
            },
            "examples": [
                "2013 Ark. App. 5"
            ],
            "mlz_jurisdiction": [
                "us:ar;appeals.court"
            ],
            "name": "Arkansas Appellate Reports",
            "variations": {
                "Ak. App.": "Ark. App.",
                "Ark.App.": "Ark. App."
            }
        }
    ]

Arkansas switched Arkansas reports, supreme and appellate to online with a VOLUME_YEAR. So I was under the impression that one, the regex pattern for volume year would indeed find those citations and the regex pattern requiring 1,3 digits would keep these two separate.

I would perhaps expect the citations_objs[0].exact_editions to not have a specific order but I dont know why its bringing back the edition that has a regex that would exclude it.