Skip to content

Commit

Permalink
link footnotes with heuristics
Browse files Browse the repository at this point in the history
  • Loading branch information
lfoppiano committed Aug 27, 2022
1 parent 0326b28 commit 04b3500
Show file tree
Hide file tree
Showing 2 changed files with 416 additions and 26 deletions.
90 changes: 90 additions & 0 deletions grobid-core/src/main/java/org/grobid/core/data/Footnote.java
@@ -0,0 +1,90 @@
package org.grobid.core.data;

import org.grobid.core.layout.LayoutToken;
import org.grobid.core.layout.Page;

import java.util.List;

import static com.google.common.collect.Iterables.getLast;

public class Footnote {

private int number;

private List<LayoutToken> tokens;

private String text;

private int offsetStartInPage;

private boolean ignored = false;

public Footnote() {
}

public Footnote(int number, List<LayoutToken> tokens, String text) {
this.number = number;
this.tokens = tokens;
this.text = text;
}

public Footnote(int number, List<LayoutToken> tokens, String text, int offsetStartInPage) {
this.number = number;
this.tokens = tokens;
this.text = text;
this.offsetStartInPage = offsetStartInPage;
}

public Footnote(int number, List<LayoutToken> tokens) {
this.number = number;
this.tokens = tokens;
}

public int getOffsetStartInPage() {
return offsetStartInPage;
}

public void setOffsetStartInPage(int offsetStartInPage) {
this.offsetStartInPage = offsetStartInPage;
}

public int getPageNumber() {
return tokens.get(0).getPage();
}

public String getText() {
return text;
}

public void setText(String text) {
this.text = text;
}

public List<LayoutToken> getTokens() {
return tokens;
}

public void setTokens(List<LayoutToken> tokens) {
this.tokens = tokens;
}

public int getNumber() {
return number;
}

public void setNumber(int number) {
this.number = number;
}

public int getOffsetEndInPage() {
return getLast(tokens).getOffset();
}

public boolean isIgnored() {
return ignored;
}

public void setIgnored(boolean ignored) {
this.ignored = ignored;
}
}

0 comments on commit 04b3500

Please sign in to comment.