Publish browser-local reference intent annotator
Browse files- LICENSE +9 -0
- README.md +7 -3
- app.js +2 -0
- en/index.html +1 -0
- fixtures/LICENSE.md +3 -0
- fixtures/invalid.json +1 -0
- fixtures/valid.json +19 -0
- index.html +2 -19
- ru/index.html +2 -0
- src/core.js +3 -0
- styles.css +1 -0
- verify.mjs +7 -0
LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2026 SHAR Production
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
| 6 |
+
|
| 7 |
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
| 8 |
+
|
| 9 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
README.md
CHANGED
|
@@ -1,10 +1,14 @@
|
|
| 1 |
---
|
| 2 |
title: Reference Intent Annotator
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: yellow
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
| 8 |
---
|
|
|
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
title: Reference Intent Annotator
|
| 3 |
+
emoji: 📝
|
| 4 |
colorFrom: yellow
|
| 5 |
+
colorTo: red
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
license: mit
|
| 9 |
---
|
| 10 |
+
# Reference Intent Annotator
|
| 11 |
|
| 12 |
+
A browser-local utility that classifies the intended production use of supplied reference links or notes without downloading materials or judging rights. It normalizes HTTPS URLs, removes tracking parameters and flags embedded credentials.
|
| 13 |
+
|
| 14 |
+
Published by [SHAR Production](https://sharprod.com/), an AI-hybrid video production studio.
|
app.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { evaluate, example } from './src/core.js';
|
| 2 |
+
const q=s=>document.querySelector(s);q('#input').value=JSON.stringify(example,null,2);q('#run').addEventListener('click',()=>{try{q('#output').textContent=JSON.stringify(evaluate(JSON.parse(q('#input').value)),null,2)}catch(e){q('#output').textContent=JSON.stringify({valid:false,errors:[{code:'JSON',message:e.message}]},null,2)}});const u=new URL('https://sharprod.com/brief/');u.searchParams.set('utm_source','shar_public_tool');u.searchParams.set('utm_medium','referral');u.searchParams.set('utm_campaign','reference-intent-annotator');u.searchParams.set('utm_content',document.documentElement.lang);q('#cta').href=u.href;
|
en/index.html
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="noindex,nofollow"><title>Reference Intent Annotator · SHAR Production</title><meta name="description" content="Classify why each reference was supplied without downloading or judging its rights."><link rel="stylesheet" href="../styles.css"></head><body><main><a class="lang" href="../ru/">Русский</a><p class="brand">SHAR Production</p><h1>Reference Intent Annotator</h1><p>Classify why each reference was supplied without downloading or judging its rights.</p><p>Data is processed only in this browser. Do not paste personal data, credentials or confidential material.</p><textarea id="input" aria-label="JSON input"></textarea><button id="run">Evaluate</button><pre id="output" aria-live="polite"></pre><a class="cta" id="cta" href="https://sharprod.com/brief/">Discuss a project</a></main><script type="module" src="../app.js"></script></body></html>
|
fixtures/LICENSE.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CC BY 4.0 synthetic fixtures
|
| 2 |
+
|
| 3 |
+
Synthetic examples in this directory are licensed under CC BY 4.0. Attribution: SHAR Production — Reference Intent Annotator, https://sharprod.com/. No real client or private data.
|
fixtures/invalid.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{}
|
fixtures/valid.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"references": [
|
| 3 |
+
{
|
| 4 |
+
"source": "https://example.com/film?utm_source=test#shot",
|
| 5 |
+
"intents": [
|
| 6 |
+
"lighting"
|
| 7 |
+
],
|
| 8 |
+
"shotIds": [
|
| 9 |
+
"s01"
|
| 10 |
+
]
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"source": "Mood note: restrained motion",
|
| 14 |
+
"intents": [
|
| 15 |
+
"motion"
|
| 16 |
+
]
|
| 17 |
+
}
|
| 18 |
+
]
|
| 19 |
+
}
|
index.html
CHANGED
|
@@ -1,19 +1,2 @@
|
|
| 1 |
-
<!doctype html>
|
| 2 |
-
|
| 3 |
-
<head>
|
| 4 |
-
<meta charset="utf-8" />
|
| 5 |
-
<meta name="viewport" content="width=device-width" />
|
| 6 |
-
<title>My static Space</title>
|
| 7 |
-
<link rel="stylesheet" href="style.css" />
|
| 8 |
-
</head>
|
| 9 |
-
<body>
|
| 10 |
-
<div class="card">
|
| 11 |
-
<h1>Welcome to your static Space!</h1>
|
| 12 |
-
<p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
|
| 13 |
-
<p>
|
| 14 |
-
Also don't forget to check the
|
| 15 |
-
<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
|
| 16 |
-
</p>
|
| 17 |
-
</div>
|
| 18 |
-
</body>
|
| 19 |
-
</html>
|
|
|
|
| 1 |
+
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="index,follow"><link rel="canonical" href="https://sharproduction-reference-intent-annotator.static.hf.space/"><link rel="alternate" hreflang="en" href="https://sharproduction-reference-intent-annotator.static.hf.space/"><link rel="alternate" hreflang="ru" href="https://sharproduction-reference-intent-annotator.static.hf.space/ru/index.html"><title>Reference Intent Annotator · SHAR Production</title><meta name="description" content="Classify why each reference was supplied without downloading or judging its rights."><link rel="stylesheet" href="./styles.css"></head><body><main><a class="lang" href="./ru/index.html">Русский</a><p class="brand">SHAR Production</p><h1>Reference Intent Annotator</h1><p>Classify why each reference was supplied without downloading or judging its rights.</p><p>Data is processed only in this browser. Do not paste personal data, credentials or confidential material.</p><textarea id="input" aria-label="JSON input"></textarea><button id="run">Evaluate</button><pre id="output" aria-live="polite"></pre><a class="cta" id="cta" href="https://sharprod.com/brief/">Discuss a project</a></main><script type="module" src="./app.js"></script></body></html>
|
| 2 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ru/index.html
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!doctype html><html lang="ru"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="index,follow"><link rel="canonical" href="https://sharproduction-reference-intent-annotator.static.hf.space/ru/index.html"><link rel="alternate" hreflang="en" href="https://sharproduction-reference-intent-annotator.static.hf.space/"><link rel="alternate" hreflang="ru" href="https://sharproduction-reference-intent-annotator.static.hf.space/ru/index.html"><title>Аннотатор назначения референсов · SHAR Production</title><meta name="description" content="Классифицирует назначение каждого референса без скачивания и оценки прав."><link rel="stylesheet" href="../styles.css"></head><body><main><a class="lang" href="../index.html">English</a><p class="brand">SHAR Production</p><h1>Аннотатор назначения референсов</h1><p>Классифицирует назначение каждого референса без скачивания и оценки прав.</p><p>Данные обрабатываются только в браузере. Не вставляйте персональные данные, реквизиты доступа или конфиденциальные материалы.</p><textarea id="input" aria-label="JSON input"></textarea><button id="run">Рассчитать</button><pre id="output" aria-live="polite"></pre><a class="cta" id="cta" href="https://sharprod.com/brief/">Обсудить проект</a></main><script type="module" src="../app.js"></script></body></html>
|
| 2 |
+
|
src/core.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export const example={references:[{source:'https://example.com/film?utm_source=test#shot',intents:['lighting'],shotIds:['s01']},{source:'Mood note: restrained motion',intents:['motion']}]};
|
| 2 |
+
const normalize=s=>{try{const u=new URL(s);if(u.protocol!=='https:')return null;if(u.username||u.password)return'credential';u.hash='';for(const k of [...u.searchParams.keys()])if(/^utm_|^(gclid|fbclid)$/i.test(k))u.searchParams.delete(k);u.searchParams.sort();return u.href}catch{return String(s).trim()}};
|
| 3 |
+
export function evaluate(x){const errors=[],warnings=[],rows=[],seen=new Set;if(!Array.isArray(x?.references))return{valid:false,errors:[{code:'INPUT'}],warnings,rows};x.references.forEach((r,i)=>{if(!String(r.source??'').trim())errors.push({code:'SOURCE',index:i});if(!Array.isArray(r.intents)||!r.intents.length)warnings.push({code:'UNCLASSIFIED',index:i});const n=normalize(r.source);if(n==='credential')errors.push({code:'CREDENTIAL_URL',index:i});else if(n===null)errors.push({code:'HTTPS_REQUIRED',index:i});else if(seen.has(n))errors.push({code:'DUPLICATE',index:i});else seen.add(n);rows.push({...r,normalizedSource:n})});return{valid:errors.length===0,errors,warnings,rows}}
|
styles.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
:root{font:16px/1.5 system-ui;color:#181817;background:#efeee8}body{margin:0}main{max-width:820px;margin:5vh auto;padding:32px;background:#fff;border-radius:18px;box-shadow:0 12px 40px #0001}.brand{font-weight:800;letter-spacing:.07em}.lang{float:right}textarea{box-sizing:border-box;width:100%;min-height:280px;padding:16px;font:14px/1.5 ui-monospace,monospace}button,.cta{display:inline-block;margin:16px 12px 0 0;padding:11px 16px;border:0;border-radius:8px;color:#fff;background:#161616;text-decoration:none;cursor:pointer}pre{white-space:pre-wrap;overflow:auto;background:#eee;padding:16px;border-radius:8px}@media(max-width:860px){main{margin:0;border-radius:0;min-height:100vh;padding:20px}.lang{float:none;display:block}}
|
verify.mjs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import assert from 'node:assert/strict';
|
| 2 |
+
import {evaluate} from './src/core.js';
|
| 3 |
+
const valid=evaluate({references:[{source:'https://example.com/a?utm_source=x#p',intents:['lighting']} ]});
|
| 4 |
+
assert.equal(valid.valid,true); assert.equal(valid.rows[0].normalizedSource,'https://example.com/a');
|
| 5 |
+
const unsafe=evaluate({references:[{source:'https://user:secret@example.com/',intents:['motion']} ]});assert.ok(unsafe.errors.some(e=>e.code==='CREDENTIAL_URL'));
|
| 6 |
+
const dup=evaluate({references:[{source:'https://example.com/a?utm_source=x',intents:['lighting']},{source:'https://example.com/a',intents:['motion']}]});assert.ok(dup.errors.some(e=>e.code==='DUPLICATE'));
|
| 7 |
+
console.log('PASS reference intent annotator scenarios: 3/3');
|