├── .github └── workflows │ └── webpack.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── package-lock.json ├── package.json ├── public ├── duckduckgo.svg ├── facebook.svg ├── favicon.ico └── google.svg ├── src ├── App.js ├── SiteFilters.js ├── TagsEditor.js ├── index.css ├── index.html └── index.js └── webpack.config.js /.github/workflows/webpack.yml: -------------------------------------------------------------------------------- 1 | name: NodeJS with Webpack 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | pull_request: 7 | branches: [ "main" ] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | 13 | strategy: 14 | matrix: 15 | node-version: [18.x] 16 | 17 | steps: 18 | - uses: actions/checkout@v3 19 | 20 | - name: Use Node.js ${{ matrix.node-version }} 21 | uses: actions/setup-node@v3 22 | with: 23 | node-version: ${{ matrix.node-version }} 24 | 25 | - name: Build 26 | run: | 27 | npm install 28 | npx webpack 29 | 30 | - name: Deploy 🚀 31 | uses: JamesIves/github-pages-deploy-action@v4 32 | with: 33 | folder: dist 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Want to report an issue or request a feature? 2 | 3 | This project consists of two separate codebases, one for the frontend search interface, and another for the generation of suggested name variants. 4 | 5 | Is there a problem with the user interface, such as button not working or a visual bug, 6 | please open an issue here: 7 | 8 | https://github.com/bellingcat/name-variant-search/issues 9 | 10 | Is there a name variant that you expect to see but is not included in the results? 11 | File your issue here: 12 | 13 | https://github.com/bellingcat/alias-generator/issues 14 | 15 | ### Tips for writing an effective issue: 16 | 17 | * Remember to search the list of open issues first, to avoid duplicates. If you see your issue has already been reported by someone else, feel free to add a comment or simply a "👍" reaction to the bottom of their report. 18 | 19 | * Keep the title short but descriptive like an email subject line, such as "Ukrainian spelling variations" 20 | 21 | * Write a detailed description, including specific examples and relevant screenshots. You can also reference other related issues by number to link to them, e.g., [#3](https://github.com/bellingcat/name-variant-search/issues/8). 22 | 23 | * Be excellent to each other. Software issues can be frustrating. Remember to comment with kindness. 24 | 25 | ## Are you a coder? 26 | 27 | Pull requests to address any open issues are welcome! Please leave a comment on any issue you'd like to work on. 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Stichting Bellingcat 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Name Variant Search Tool 2 | 3 | https://bellingcat.github.io/name-variant-search/ 4 | 5 | ### Motivation 6 | 7 | When researching an individual online, it is useful to search not only for their full legal name but also for many variants. This can become tedious and time consuming for the researcher and could be streamlined. 8 | 9 | ### Goal 10 | 11 | Given a person's name, generate various plausible alternative forms of the name and streamline the work of researching each one. 12 | 13 | ## Generating variants 14 | 15 | Generating variants is handled by the node module [alias-generator](https://github.com/bellingcat/alias-generator) 16 | 17 | TextGain's language ID api may be useful when deciding which culturally-specific variants to include: https://apiv2.textgain.com/redoc#tag/Identification/operation/language_identification_language_post 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "name-variant-search", 3 | "version": "1.0.0", 4 | "description": "A tool for researching a person's name online in multiple formats", 5 | "scripts": { 6 | "dev": "webpack serve --no-client-overlay-warnings ", 7 | "build": "webpack" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/bellingcat/name-variant-search.git" 12 | }, 13 | "author": "Stichting Bellingcat", 14 | "license": "MIT", 15 | "bugs": { 16 | "url": "https://github.com/bellingcat/name-variant-search/issues" 17 | }, 18 | "homepage": "https://github.com/bellingcat/name-variant-search#readme", 19 | "devDependencies": { 20 | "@babel/core": "^7.22.9", 21 | "@babel/plugin-syntax-import-assertions": "^7.22.5", 22 | "@babel/preset-env": "^7.22.9", 23 | "@babel/preset-react": "^7.22.5", 24 | "babel-loader": "^9.1.3", 25 | "css-loader": "^6.8.1", 26 | "html-loader": "^4.2.0", 27 | "html-webpack-plugin": "^5.5.3", 28 | "style-loader": "^3.3.3", 29 | "webpack": "^5.88.2", 30 | "webpack-cli": "^5.1.4", 31 | "webpack-dev-server": "^4.15.1" 32 | }, 33 | "dependencies": { 34 | "@bellingcat/alias-generator": "^4.0.0", 35 | "@fortawesome/free-solid-svg-icons": "^6.4.2", 36 | "@fortawesome/react-fontawesome": "^0.2.0", 37 | "react": "^18.2.0", 38 | "react-dom": "^18.2.0", 39 | "react-hot-toast": "^2.4.1", 40 | "react-tag-input-component": "^2.0.2" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /public/duckduckgo.svg: -------------------------------------------------------------------------------- 1 | duckduckgo -------------------------------------------------------------------------------- /public/facebook.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 9 | 10 | 11 | 12 | 13 | 15 | 17 | 18 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bellingcat/name-variant-search/c172abfe093e8ba4283bcc6b05a9ea03da4f1f12/public/favicon.ico -------------------------------------------------------------------------------- /public/google.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import TagsEditor from './TagsEditor'; 3 | import SiteFilters from './SiteFilters'; 4 | 5 | function constructGoogleQuery(names, sites) { 6 | const nameQuery = names.map((name) => `\"${name}\"`).join(" OR "); 7 | 8 | if (sites.length) { 9 | const siteFilter = sites.map((site) => `site:${site}`).join(" OR "); 10 | return `${nameQuery} (${siteFilter})`; 11 | } else { 12 | return nameQuery; 13 | } 14 | } 15 | 16 | const App = () => { 17 | const [names, setNames] = useState([]); 18 | const [sites, setSites] = useState([]); 19 | 20 | const searchInput = document.querySelector('input.gsc-input'); 21 | if (searchInput) { 22 | searchInput.value = constructGoogleQuery(names, sites); 23 | const searchButton = document.querySelector('button.gsc-search-button'); 24 | searchButton.click(); 25 | } 26 | 27 | const searchResults = document.querySelector('#searchResults'); 28 | if (searchResults) { 29 | if (names.length > 0) { 30 | searchResults.className = ''; 31 | } else { 32 | searchResults.className = 'hide'; 33 | } 34 | } 35 | 36 | return ( 37 | <> 38 |
39 | 40 | { names.length > 0 ? : null } 41 |
42 | 43 | ); 44 | }; 45 | 46 | export default App; 47 | -------------------------------------------------------------------------------- /src/SiteFilters.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | 3 | const SiteFilters = (props) => { 4 | const SITES = [ 5 | {name: "facebook", url: "facebook.com"}, 6 | {name: "linkedin", url: "linkedin.com"}, 7 | {name: "twitter", url: "twitter.com"}, 8 | ]; 9 | 10 | const [selected, setSelected] = useState([]); 11 | 12 | function onChangeHandler(e) { 13 | let value = e.currentTarget.value; 14 | let checked = e.currentTarget.checked; 15 | let newSelected = [...selected]; 16 | if (checked) { 17 | if (selected.indexOf(value) == -1) { 18 | newSelected = [...selected, value]; 19 | } 20 | } else { 21 | newSelected = selected.filter((site) => site != value); 22 | } 23 | setSelected(newSelected); 24 | props.onChange(newSelected); 25 | } 26 | 27 | const siteCheckbox = function(site) { 28 | return
29 | 30 | 31 |
; 32 | } 33 | 34 | return ( 35 |
36 |

Sites

37 |

Filter by website:

38 |
39 | {SITES.map(siteCheckbox)} 40 |
41 |
42 | ); 43 | }; 44 | 45 | export default SiteFilters; 46 | -------------------------------------------------------------------------------- /src/TagsEditor.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { getAliases } from '@bellingcat/alias-generator'; 3 | import { TagsInput } from "react-tag-input-component"; 4 | import { Toaster, toast } from 'react-hot-toast'; 5 | import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' 6 | import { faCopy } from '@fortawesome/free-solid-svg-icons' 7 | 8 | function copyToClipboard(name) { 9 | navigator.clipboard.writeText(name); 10 | toast.success("Copied to clipboard", {id: 'clipboard'}); 11 | } 12 | 13 | function searchButtons(query) { 14 | return 15 | { button("", 'google', google(query)) } 16 | { button("", 'ddg', ddg(query)) } 17 | { button("", 'facebook', facebook(query)) } 18 | 19 | copyToClipboard(query)}> 20 | 21 | 22 | ; 23 | } 24 | 25 | function button(text, className, href) { 26 | return 27 | {text} 28 | ; 29 | } 30 | 31 | function facebook(query) { 32 | if (Array.isArray(query)) { 33 | query = query.join("%20OR%20") 34 | } 35 | return `https://www.facebook.com/search/people/?q=${query}`; 36 | } 37 | 38 | function google(query) { 39 | if (Array.isArray(query)) { 40 | query = query.join(" OR "); 41 | } 42 | return `https://google.com/search?q=${query}`; 43 | } 44 | function ddg(query) { 45 | if (Array.isArray(query)) { 46 | query = query.join(" "); 47 | } 48 | return `https://duckduckgo.com/?q=${query}`; 49 | } 50 | 51 | const TagsEditor = (props) => { 52 | const [selected, setSelected] = useState([]); 53 | const [suggested, setSuggested] = useState(new Set()); 54 | 55 | function onChangeHandler(newSelected) { 56 | newSelected = newSelected.map(function(name) { 57 | return name.toLowerCase(); 58 | }) 59 | setSelected(newSelected); 60 | props.onChange(newSelected); 61 | 62 | newSelected.forEach(function(name) { 63 | let newSuggested = new Set(suggested); 64 | const results = getAliases(name).forEach(function(name) { 65 | newSuggested.add(name); 66 | }); 67 | setSuggested(newSuggested); 68 | }); 69 | } 70 | 71 | function addSuggestion(event) { 72 | console.log(arguments); 73 | let name = event.currentTarget.dataset.name; 74 | if (selected.indexOf(name) >= 0) { 75 | // dupe 76 | } else { 77 | setSelected([...selected, name]); 78 | } 79 | } 80 | 81 | if (selected.length <= 0) { 82 | suggested.clear(); 83 | } 84 | return ( 85 |
86 | 87 |
88 |
89 |

Search for exact matches on any of these names:

90 | 94 | Press Enter to add new name. Backspace to delete. 95 |
96 |
97 | { (suggested.size) > 0 ?

Suggestions

: null} 98 | 114 |
115 | ); 116 | }; 117 | 118 | export default TagsEditor; 119 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 1em; 3 | font-family: "Helvetica", Arial, sans-serif; 4 | font-size: 18px; 5 | } 6 | button, input { 7 | font-size: 16px; 8 | } 9 | .form { 10 | margin-bottom: 1em; 11 | } 12 | .result { 13 | display: flex; 14 | align-items: center; 15 | } 16 | .name { 17 | flex-grow:1; 18 | padding: 0 5px; 19 | text-transform: capitalize; 20 | } 21 | .rti--tag { 22 | text-transform: capitalize; 23 | } 24 | li:nth-child(odd) { 25 | background: #eee; 26 | } 27 | #output { 28 | max-width: 800px; 29 | } 30 | .footer { 31 | margin-top: 50px; 32 | color: #aaa; 33 | } 34 | .footer a, .footer a:visited { 35 | color: #1b73e9; 36 | } 37 | .container { 38 | display: flex; 39 | flex-direction: row; 40 | } 41 | .left { 42 | min-width: 400px; 43 | } 44 | .left ul { 45 | padding: 0; 46 | } 47 | .rti--tag { 48 | background-color: whiteSmoke; 49 | background-image: linear-gradient(top, whiteSmoke, #f1f1f1); 50 | border: 1px solid rgba(0, 0, 0, 0.1); 51 | border-radius: 2px; 52 | box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); 53 | } 54 | .rti--container { 55 | margin-bottom: 5px; 56 | } 57 | em { 58 | margin-top: 0.5em; 59 | font-size: small; 60 | color: #757575; 61 | } 62 | .searchButtons .logo { 63 | display: inline-block; 64 | width: 25px; 65 | height: 25px; 66 | border: none; 67 | margin: 2px; 68 | background-size: contain; 69 | background-position: center; 70 | } 71 | .searchButtons a { 72 | cursor: pointer; 73 | } 74 | .google { 75 | background: url("../public/google.svg"); 76 | } 77 | .ddg { 78 | background: url("../public/duckduckgo.svg"); 79 | } 80 | .facebook { 81 | background: url("../public/facebook.svg"); 82 | } 83 | .hide { 84 | display: none; 85 | } 86 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Name Variant Search 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

Name Variant Search

13 | 15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | 23 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | import React from 'react'; 3 | import { createRoot } from 'react-dom/client'; 4 | import App from './App'; 5 | 6 | window.onload = function() { 7 | let output = document.querySelector("#output"); 8 | const root = createRoot(output); 9 | root.render( ); 10 | }; 11 | 12 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const HtmlWebpackPlugin = require('html-webpack-plugin'); 2 | const path = require('path'); 3 | 4 | const config = { 5 | target: 'web', 6 | mode: 'production', 7 | entry: './src/index.js', 8 | devtool: 'inline-source-map', 9 | output: { 10 | path: path.resolve('dist'), 11 | filename: 'bundle.js', 12 | }, 13 | module: { 14 | rules: [ 15 | { 16 | test: /\.html?$/, 17 | use: 'html-loader', 18 | }, 19 | { 20 | test: /\.js?$/, 21 | use: { 22 | loader: 'babel-loader', 23 | options: { 24 | presets: ['@babel/preset-env', '@babel/preset-react'], 25 | plugins: ['@babel/plugin-syntax-import-assertions'] 26 | }, 27 | } 28 | }, 29 | { 30 | test: /\.css$/i, 31 | use: ['style-loader', 'css-loader'], 32 | }, 33 | { 34 | test: /\.(ico|png|svg|jpg|jpeg|gif)$/i, 35 | type: 'asset/resource', 36 | }, 37 | ], 38 | }, 39 | resolve: { 40 | extensions: ['.js'], 41 | }, 42 | plugins: [ 43 | new HtmlWebpackPlugin({ 44 | template: './src/index.html', // Path to your source HTML file 45 | filename: 'index.html', // Output file name 46 | inject: 'head', 47 | scriptLoading: 'blocking', 48 | }), 49 | ], 50 | }; 51 | 52 | module.exports = config; 53 | --------------------------------------------------------------------------------