Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse 1998 data error #5

Open
GengYuIsland opened this issue May 10, 2024 · 0 comments
Open

Parse 1998 data error #5

GengYuIsland opened this issue May 10, 2024 · 0 comments

Comments

@GengYuIsland
Copy link

Hello coder, when I try to parse the data of 1998, there's an error, the func "def get_patents_list" will return a null list, if I change the code to this:

def get_patents_list(patents_txt_data):
    patents_data = []
    current_patent = []
    for line in patents_txt_data[1:]:
        cleaned_line = ' '.join(line.split())
        if cleaned_line.startswith('PATN'):
            if current_patent:
                patents_data.append(current_patent)
                current_patent = []
            current_patent.append(cleaned_line)
        else:
            current_patent.append(cleaned_line)
    if current_patent:
        patents_data.append(current_patent)
    for i in range(len(patents_data)):
        patent = patents_data[i]
        patents_data[i] = [[word for word in line.split() if word] for line in patent]
    return patents_data

Then It works.
However, it only fits 1998, when I try to use the new func to parse 1999, it didn't.
I guess you must didn't test all the years, so can you help me to solve this problem and make the code more strong? Thank you a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant