mirror of
https://github.com/jzillmann/pdf-to-markdown.git
synced 2024-11-23 16:23:54 +01:00
No unused locals
This commit is contained in:
parent
17290cf746
commit
f5a180113d
@ -20,8 +20,8 @@ const config = {
|
||||
// Max number of lines at top/bottom (per page) which are getting evaluated for eviction
|
||||
maxNumberOffTopOrBottomLines: 3,
|
||||
|
||||
// From the absolute fringe elements (min/max y) how much y can item deviate before beeing disregarded.
|
||||
maxDistanceFromFringeElements:30,
|
||||
// From the absolute fringe elements (min/max y) how much y can item deviate before beeing disregarded.
|
||||
maxDistanceFromFringeElements: 30,
|
||||
|
||||
// Max neighbour taken (in one direction) for detecting neighbour similarity.
|
||||
// Choosen number might be more effectful for PDFs with a strong odd/evan page differernce.
|
||||
@ -54,7 +54,7 @@ export default class RemoveRepetitiveItems extends ItemTransformer {
|
||||
const yLines = pageExtracts
|
||||
.map((page) => page.lineByY(y))
|
||||
.filter((line) => typeof line !== 'undefined') as Line[];
|
||||
const texts = yLines.map((line) => line.text());
|
||||
|
||||
const similarities = flatMap(yLines, (line, idx) =>
|
||||
adiacentLines(yLines, idx).map((adiacentLine) => calculateSimilarity(line, adiacentLine)),
|
||||
);
|
||||
@ -66,6 +66,7 @@ export default class RemoveRepetitiveItems extends ItemTransformer {
|
||||
// - contain chapter highlights
|
||||
// - contains rising number
|
||||
|
||||
// const texts = yLines.map((line) => line.text());
|
||||
// console.log('y' + y, texts, similarities, median(similarities));
|
||||
return median(similarities) >= config.minSimilarity;
|
||||
});
|
||||
|
@ -2,7 +2,6 @@ import { toMatchFile } from 'jest-file-snapshot';
|
||||
|
||||
import * as pdfjs from 'pdfjs-dist/es5/build/pdf';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
import PdfParser from 'src/PdfParser';
|
||||
import PdfPipeline from 'src/PdfPipeline';
|
||||
|
@ -92,7 +92,6 @@ function expectTotalProgress(progress: Progress, expected: number) {
|
||||
|
||||
function expectStageInProgress(progress: Progress, stageIndex: number) {
|
||||
for (let index = 0; index < progress.stageProgress.length; index++) {
|
||||
const stageProgress = progress.stageProgress[index];
|
||||
if (index < stageIndex) {
|
||||
expect(progress.isProgressing(index)).toBe(false);
|
||||
expect(progress.isComplete(index)).toBe(true);
|
||||
|
@ -1,8 +1,7 @@
|
||||
import ChangeTracker from 'src/debug/ChangeTracker';
|
||||
import { detectChanges } from 'src/debug/detectChanges';
|
||||
import { PositionChange, Direction, Addition, Removal } from 'src/debug/ChangeIndex';
|
||||
import { idItem, idItems, items } from 'test/testItems';
|
||||
import Item from 'src/Item';
|
||||
import { idItem, idItems } from 'test/testItems';
|
||||
|
||||
test('No changes', async () => {
|
||||
const items = idItems(0, ['A', 'B', 'C']);
|
||||
|
@ -6,6 +6,7 @@
|
||||
"outDir": "./lib",
|
||||
"strict": true,
|
||||
"noImplicitAny": false,
|
||||
"noUnusedLocals": true,
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"src/*": ["src/*"],
|
||||
|
Loading…
Reference in New Issue
Block a user