diff options
| -rw-r--r-- | .dir-locals.el | 7 | ||||
| -rw-r--r-- | .envrc | 1 | ||||
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | README.org | 6 | ||||
| -rwxr-xr-x | pairwise.pl | 8 | ||||
| -rw-r--r-- | shell.nix | 13 |
6 files changed, 32 insertions, 5 deletions
diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 0000000..55b82b2 --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,7 @@ +;;; Directory Local Variables -*- no-byte-compile: t -*- +;;; For more information see (info "(emacs) Directory Variables") + +((nil . ((compile-command . "make serve"))) + (js-base-mode . ((js-indent-level . 4) + (js-chain-indent . t) + (js-indent-first-init . dynamic)))) @@ -0,0 +1 @@ +use nix diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..aedafd5 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +serve: + python -m http.server 31337 @@ -40,12 +40,12 @@ or, in csv: * runners #+name: process -#+begin_src shell :results file :file n-401-94.csv :var threshold=94.0 filename="inputs/n-401.csv" - guix shell perl -- ./pairwise.pl $threshold $filename +#+begin_src shell :results file :file paplcv-nov-16-2024-aligned_mat-90.5.csv :var threshold=90.5 filename="inputs/PapLCV-Nov-16-2024-Aligned_mat.csv" + nix-shell --run "./pairwise.pl $threshold $filename" #+end_src #+RESULTS: process -[[file:n-401-94.csv]] +[[file:paplcv-nov-16-2024-aligned_mat-90.5.csv]] #+call: process[:file n-402-90.5.csv](threshold=90.5, filename="n-402.csv") diff --git a/pairwise.pl b/pairwise.pl index f721575..693b664 100755 --- a/pairwise.pl +++ b/pairwise.pl @@ -3,6 +3,8 @@ use strict; use warnings; +use Scalar::Util qw(looks_like_number); + die "usage: $0 threshold file […]\n" unless $#ARGV > 0; my $threshold = shift; @@ -14,9 +16,11 @@ while (<>) { chomp; my @parts = split /,/; for (my $i=1; $i <= $#headers; $i++) { - if (defined $parts[$i]) { + if (defined $parts[$i] && looks_like_number($parts[$i])) { + # print STDERR "#h: $#headers #p: $#parts\n"; + # print STDERR "parts: @parts\n"; my $similarity = $parts[$i]; - print "$parts[0],$headers[$i]\n" if $similarity >= $threshold; + print "$parts[0],$headers[$i]\n" if $similarity > $threshold; } } } diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..0f5c343 --- /dev/null +++ b/shell.nix @@ -0,0 +1,13 @@ +{ pkgs ? import <nixpkgs> {} }: + +pkgs.mkShell { + packages = with pkgs; [ + perl + gnumake + python3 + typescript-language-server + vscode-langservers-extracted + ]; + + TMPDIR = "/tmp"; # lsp needs it +} |
