Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ I have no plans to shut down or increase/decrease my level of support for the si

Thank you all for the support over the past few years!

## How to run this code

Install NPM per your OS-specific guidance found here: https://nodejs.org/en/download/package-manager

run 'npm run build'
cd into the build directory, then serve the files via an HTTP server

If testing on Windows, these commands will do for testing (use a better server for production):

'npm run build; cd build; python -m http.server'; then browse to http://localhost:8000

## pdf analysis of air force forms

One of the most pointless and time-consuming things that Air Force officer and enlisted personnel do every year is bullet-writing.
Expand Down
Binary file modified abbrs.xlsx
Binary file not shown.
20 changes: 13 additions & 7 deletions src/BulletApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { tokenize } from "./components/Bullets/utils";
import AbbreviationViewer from "./components/Abbreviation/AbbreviationViewer";
import SynonymViewer from "./components/Toolbars/Thesaurus.js";
import { EditorState, ContentState, Modifier, SelectionState, CompositeDecorator } from "draft-js";
import { defaultAbbrData, defaultText, defaultWidth } from "./const/defaults";
import { defaultAbbrData, defaultText, defaultWidth, stopWords } from "./const/defaults";

const defaultEditorState = EditorState.createWithContent(
ContentState.createFromText(defaultText)
Expand Down Expand Up @@ -186,9 +186,12 @@ function BulletApp({enableHighlight, onHighlightChange}) {

function findWithRegex(duplicates, contentBlock, callback) {
const text = contentBlock.getText();
const duplicatesMinusStopWords = new Set(duplicates).difference(stopWords);

duplicates.forEach(word => {
const matches = [...text.matchAll(word)];
duplicatesMinusStopWords.forEach(word => {
// use global (g) and case insensitive (i) match
let re = new RegExp(String.raw`\s${word}\s`, "gi");
const matches = [...text.matchAll(re)];
matches.forEach(match =>
callback(match.index, match.index + match[0].length)
);
Expand Down Expand Up @@ -327,10 +330,13 @@ function BulletApp({enableHighlight, onHighlightChange}) {

function findWithRegex(duplicates, contentBlock, callback) {
const text = contentBlock.getText();

duplicates.forEach(word => {
const matches = [...text.matchAll(word)];
matches.forEach(match =>
const duplicatesMinusStopWords = new Set(duplicates).difference(stopWords);

duplicatesMinusStopWords.forEach(word => {
// use global (g) and case insensitive (i) match
let re = new RegExp(String.raw`\s${word}\s`, "gi");
const matches = [...text.matchAll(re)];
matches.forEach(match =>
callback(match.index, match.index + match[0].length)
);
});
Expand Down
8 changes: 6 additions & 2 deletions src/components/Bullets/BulletComparator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useState, useEffect } from "react";
import { Editor, RichUtils, CompositeDecorator, EditorState } from "draft-js";
import "draft-js/dist/Draft.css";
import Bullet from "./Bullet";
import { stopWords } from "../../const/defaults";


const DPI = 96;
Expand Down Expand Up @@ -66,9 +67,12 @@ export default function BulletComparator({

function findWithRegex(duplicates, contentBlock, callback) {
const text = contentBlock.getText();
const duplicatesMinusStopWords = new Set(duplicates).difference(stopWords);

duplicates.forEach(word => {
const matches = [...text.matchAll(word)];
duplicatesMinusStopWords.forEach(word => {
// use global (g) and case insensitive (i) match
let re = new RegExp(String.raw`\s${word}\s`, "gi");
const matches = [...text.matchAll(re)];
matches.forEach(match =>
callback(match.index, match.index + match[0].length)
);
Expand Down
Loading