• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kermitt2 / grobid / 390

pending completion
390

push

circleci

more log debug; model update

2 of 2 new or added lines in 2 files covered. (100.0%)

14847 of 37498 relevant lines covered (39.59%)

0.4 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/grobid-core/src/main/java/org/grobid/core/document/PatentDocument.java
1
package org.grobid.core.document;
2

3
import org.grobid.core.layout.*;
4

5
import java.util.regex.Matcher;
6
import java.util.regex.Pattern;
7

8
/**
9
 * Class for additional information for patent document.
10
 *
11
 */
12
public class PatentDocument extends Document {
13

14
    private int beginBlockPAReport = -1;
×
15

16
    static public Pattern searchReport =
×
17
            Pattern.compile("((international|interna(\\s)+Η(\\s)+onal)(\\s)+(search)(\\s)+(report))|" +
×
18
                    "((internationaler)(\\s)+(recherchenberich))|" +
19
                    "(I(\\s)+N(\\s)+T(\\s)+E(\\s)+R(\\s)+N(\\s)+A(\\s)+T(\\s)+I(\\s)+O(\\s)+N(\\s)+A(\\s)+L(\\s)+S(\\s)+E(\\s)+A(\\s)+R(\\s)+C(\\s)+H)",
20
                    Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);
21

22
    static public Pattern FamilyMembers =
×
23
            Pattern.compile("(patent)(\\s)+(famil(v|y))(\\s)+(members)?",
×
24
                    Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);
25

26
    public PatentDocument(DocumentSource documentSource) {
27
        super(documentSource);
×
28
    }
×
29

30
    public int getBeginBlockPAReport() {
31
        return beginBlockPAReport;
×
32
    }
33

34
    public void setBeginBlockPAReport(int begin) {
35
        beginBlockPAReport = begin;
×
36
    }
×
37

38
    /**
39
     * Return all blocks corresponding to the prior art report of a WO patent publication
40
     */
41
    public String getWOPriorArtBlocks() {
42
        System.out.println("getWOPriorArtBlocks");
×
43
        StringBuilder accumulated = new StringBuilder();
×
44
        int i = 0;
×
45
        boolean PAReport = false;
×
46
        boolean newPage = false;
×
47
        if (getBlocks() != null) {
×
48
            for (Block block : getBlocks()) {
×
49
                String content = block.getText();
×
50
                if (content != null) {
×
51
                    content = content.trim();
×
52
                    //System.out.println(content);
53
                    if (newPage & (!PAReport)) {
×
54
                        //System.out.println("new page");
55
                        Matcher m = PatentDocument.searchReport.matcher(content);
×
56

57
                        if (m.find()) {
×
58
                            PAReport = true;
×
59
                            beginBlockPAReport = i;
×
60
                        }
61
                    }
62

63
                    /*if (PAReport) {
64
                             Matcher m = FamilyMembers.matcher(content);
65

66
                             if (m.find()) {
67
                                 PAReport = false;
68
                             }
69
                         }*/
70

71
                    newPage = content.startsWith("@PAGE");
×
72

73
                    if (PAReport)
×
74
                        accumulated.append(content).append("\n");
×
75
                }
76
                i++;
×
77
            }
×
78
        }
79
        System.out.println(accumulated.toString());
×
80
        return accumulated.toString();
×
81
    }
82

83
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc