### Install openlexicon.fetcher from GitHub
Source: https://github.com/chrplr/openlexicon/blob/master/packages/openlexicon.fetcher/README.md
Installs the development version of the openlexicon.fetcher package from GitHub. Requires the devtools package.
```r
# install.packages("devtools")
devtools::install_github("chrplr/openlexicon/packages/openlexicon.fetcher")
```
--------------------------------
### Install RShiny Packages and Shiny Server on Ubuntu
Source: https://github.com/chrplr/openlexicon/blob/master/README-server-installation.md
Run these commands to install the 'shiny', 'DT', and 'rmarkdown' R packages, then download and install the Shiny Server DEB package using `gdebi`.
```bash
sudo su - -c "R -e \"install.packages('shiny', repos='http://cran.rstudio.com/')\""
```
```bash
sudo su - -c "R -e \"install.packages('DT','rmarkdown')\""
```
```bash
sudo apt-get install -y gdebi-core
```
```bash
sudo wget https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.9.923-amd64.deb
```
```bash
sudo gdebi shiny-server-1.5.9.923-amd64.deb
```
--------------------------------
### Install R Base and Dependencies on Ubuntu
Source: https://github.com/chrplr/openlexicon/blob/master/README-server-installation.md
Execute these commands sequentially to add the R CRAN repository, update package lists, and install R base along with essential build tools on an Ubuntu server.
```bash
sudo apt install -y apt-transport-https software-properties-common
```
```bash
sudo apt install -y build-essential
```
```bash
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
```
```bash
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
```
```bash
sudo apt update
```
```bash
sudo apt install -y r-base
```
--------------------------------
### Selector Engine Tests and Setup
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/lexical-frequencies/french-lexical-frequencies.html
Initializes and tests various selector functionalities, including attribute selectors, pseudo-classes, and ID matching. This setup is crucial for the selector engine's compatibility checks.
```javascript
r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]=" + L + "*(?:''|""")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|" + K + ")"),a.querySelectorAll("[id~="+u+"-").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll(",:x"),q.push(",.")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[!=''':x]"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1'"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{
```
--------------------------------
### Context Search Configuration
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Example of configuring context search parameters. Useful for setting up default search behaviors.
```javascript
const searchConfig = {
maxResults: 10,
timeout: 5000,
// other configurations
};
function searchWithConfig(query, context, config) {
// Use config to perform search
return results;
}
```
--------------------------------
### Context Search Callback Example
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Shows how to use a callback function with context search to handle results asynchronously. Suitable for non-blocking operations.
```javascript
function contextSearchWithCallback(query, context, callback) {
// Perform search and call callback with results
callback(results);
}
```
--------------------------------
### Lexique383 JSON Metadata Example
Source: https://github.com/chrplr/openlexicon/blob/master/datasets-info/links/README-json.md
This JSON object provides metadata for the Lexique383 lexical database, including its name, a detailed description, website, readme link, download URL, file size, and MD5 checksum. It serves as an example of the structure used for describing lexical databases.
```json
{
"name": "lexique383",
"description": "Donne pour 140 000 mots français la fréquences d’occurrences dans différents corpus, la représentation phonologique, les lemmes associés, le nombre de syllabes, la catégorie grammaticale, etc.",
"website": "http://www.lexique.org",
"readme": "https://chrplr.github.io/openlexicon/datasets-info/Lexique383/README-Lexique.html",
"url_rds": "http://www.lexique.org/databases/Lexique383/Lexique383.rds",
"bytes": 5923649,
"md5sum": "0f3329ff256333332bd0705e29b69e65"
}
```
--------------------------------
### Get List of Available Datasets
Source: https://github.com/chrplr/openlexicon/blob/master/packages/openlexicon.fetcher/README.md
Retrieves a list of all lexical datasets that can be downloaded using the openlexicon.fetcher package.
```r
# getting a list of all available datasets
available_datasets()
```
--------------------------------
### Context Search with Wildcards
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Example of using wildcard characters in context search queries. Useful for pattern matching.
```javascript
function searchWithWildcards(query, context) {
// Implementation supporting wildcard queries
return results;
}
```
--------------------------------
### jQuery AJAX Setup Configuration
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Configures global AJAX settings. These settings can be overridden by individual AJAX calls.
```javascript
m.ajaxSetup=function(a,b){return b?Nb(Nb(a,m.ajaxSettings),b):Nb(m.ajaxSettings,a)}
```
--------------------------------
### Advanced Context Search Parameters
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
This example shows how to specify advanced parameters for a context search, allowing for more refined results. It includes options for context window size and search direction.
```HTML
```
--------------------------------
### Interactive Mode Notice
Source: https://github.com/chrplr/openlexicon/blob/master/packages/openlexicon.fetcher/LICENSE.md
This is a notice to be displayed when the program starts in interactive mode, providing copyright and licensing information.
```text
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'show c' for details.
```
--------------------------------
### Get Element Dimensions
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Provides methods to get the dimensions (height and width) of elements, including padding and borders. Supports getting inner, outer, and content dimensions.
```javascript
m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||"boolean"!=typeof d&&"margin";return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})})}
```
--------------------------------
### Exécution de la compilation avec Make
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/french-syllabation/README.md
Si Make est installé, exécutez 'make' pour compiler le projet. Cela générera les fichiers nécessaires à la syllabation.
```bash
make
```
--------------------------------
### Get Scroll Position
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Gets the current horizontal or vertical scroll position of the first element in the set of matched elements. Can be used to get or set scrollLeft or scrollTop.
```javascript
m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dc(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)})}
```
--------------------------------
### Context Search Initialization
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Demonstrates the initialization process for a context search module. Ensure this is called before performing searches.
```javascript
function initializeContextSearch() {
// Setup and initialization logic
console.log('Context search initialized.');
}
```
--------------------------------
### Get Element Offset
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Gets the current coordinates of the first element in the set of matched elements relative to the document. Returns an object with 'top' and 'left' properties.
```javascript
m.fn.offset=function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dc(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d}
```
--------------------------------
### Exécution des tests avec Make
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/french-syllabation/README.md
Si Make est installé, exécutez 'make test' pour lancer les tests du projet. Cela vérifiera la fonctionnalité du script de syllabation.
```bash
make test
```
--------------------------------
### Get Element Position
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Gets the calculated top and left position of the first element in the set of matched elements, relative to its offset parent. Returns an object with 'top' and 'left' properties.
```javascript
m.fn.position=function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}}
```
--------------------------------
### Build Tabsets
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Initializes tabset navigation on the document ready event.
```javascript
$(document).ready(function () { window.buildTabsets("TOC"); });
```
--------------------------------
### Get Window or Document Element
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Helper function to get the window or document element associated with a node. Returns the window if the node is a window, or the default view of the document if it's a document node.
```javascript
function dc(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}
```
--------------------------------
### jQuery.css - Get computed style of an element
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Retrieves the computed value of a CSS property for a given element. It handles vendor prefixes, default values, and unit conversions, providing a reliable way to get style information.
```javascript
css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ua(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Ja(a,b,d)),"normal"===f&&b in Sa&&(f=Sa[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}
```
--------------------------------
### Tooltip/Popover Initialization Options
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Default configuration options for Bootstrap tooltips and popovers. Customize trigger, delay, and container behavior.
```javascript
class="tooltip-inner">',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("\`selector\` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()}
```
--------------------------------
### Getting Computed Styles
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
These functions provide cross-browser methods for retrieving the computed style of an element. `Ia` gets the computed style object, and `Ja` retrieves a specific CSS property value, handling various edge cases.
```javascript
Ia=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b))),Ha.test(g)&&Ga.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ia=function(a){return a.currentStyle},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Ha.test(g)&&!Ka.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"})
```
--------------------------------
### Get File Sizes and MD5 Sums
Source: https://github.com/chrplr/openlexicon/blob/master/datasets-info/README-how-to-install-a-new-database.md
These commands show how to obtain file sizes and MD5 checksums for database files using `ls -l` and `md5sum` on the command line. This information is needed for the JSON description file.
```bash
ls -l *.{rds,tsv}
```
```bash
md5sum *.{rds,tsv}
```
--------------------------------
### Getting and Setting HTML Content
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
The `html()` method is used to get the HTML content of the first element in the set of matched elements or to set the HTML content for every matched element. It handles the complexities of inserting HTML, including script execution.
```javascript
html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1>$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)}
```
--------------------------------
### jQuery getJSON Function
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
A shorthand method for making a JSON-returning AJAX request using GET.
```javascript
m.getJSON=function(a,b,c){return m.get(a,b,c,"json")}
```
--------------------------------
### Download All Available Datasets
Source: https://github.com/chrplr/openlexicon/blob/master/packages/openlexicon.fetcher/README.md
Downloads all lexical datasets supported by the openlexicon.fetcher package. Datasets are saved to '~/openlexicon_datasets/' by default.
```r
# downloading them all
get_all_datasets()
```
--------------------------------
### Get Unique Words
Source: https://github.com/chrplr/openlexicon/blob/master/documents/Interroger-Lexique-avec-R/interroger-lexique-avec-R.html
Retrieves a list of all unique words in the lexicon. This can be used to create a vocabulary list.
```r
unique(lexicon$X.LEXICAL_WORD.)
```
--------------------------------
### Clone OpenLexicon RShiny Applications
Source: https://github.com/chrplr/openlexicon/blob/master/README-server-installation.md
Navigate to the home directory and clone the `openlexicon` repository into a `shiny-server` directory to deploy the RShiny applications.
```bash
cd
```
```bash
git clone https://github.com/chrplr/openlexicon.git shiny-server
```
```bash
cd shiny-server/
```
--------------------------------
### Highlight.js Configuration and Initialization
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Configures and initializes Highlight.js for code syntax highlighting. It sets supported languages and triggers highlighting on page load.
```javascript
if (window.hljs) {
hljs.configure({languages: []});
hljs.initHighlightingOnLoad();
if (document.readyState && document.readyState === "complete") {
window.setTimeout(function() {
hljs.initHighlighting();
}, 0);
}
}
```
--------------------------------
### Get Padding Count
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Returns the current padding count for columns. This value is used in width calculations and rendering.
```javascript
me.getPaddingCount = function() { return me.padding; };
```
--------------------------------
### Example JSON Description File for Lexique3
Source: https://github.com/chrplr/openlexicon/blob/master/datasets-info/README-how-to-install-a-new-database.md
This JSON file describes the Lexique3 database, including its name, description, website, and URLs for TSV and RDS files. It also specifies the data type and relevant tags.
```json
{
"_comment": "# Time-stamp: <2019-04-30 17:01:41 christophe@pallier.org>",
"name": "lexique3",
"description": "Lexique382 est une base de données lexicales du français qui fournit pour ~140000 mots du français: les représentations orthographiques et phonémiques, les lemmes associés, la syllabation, la catégorie grammaticale, le genre et le nombre, les fréquences dans un corpus de livres et dans un corpus de sous-titres de filems, etc.",
"website": "http://www.lexique.org",
"readme": "https://chrplr.github.io/openlexicon/datasets-info/Lexique382/README-Lexique.html",
"urls": [
{
"url": "http://www.lexique.org/databases/Lexique382/Lexique382.tsv",
"bytes": 25850842,
"md5sum": "28d18d7ac1464d09e379f30995d9d605"
},
{
"url": "http://www.lexique.org/databases/Lexique382/Lexique382.rds",
"bytes": 5923674,
"md5sum": "e3e5f47409b91fdb620edfdd960dd7a5"
}
],
"type": "tsv",
"tags": ["french", "frequencies"]
}
```
--------------------------------
### Configure Shiny Server for OpenLexicon Apps
Source: https://github.com/chrplr/openlexicon/blob/master/README-server-installation.md
Modify the `shiny-server.conf` file to define the server's listening port, specify the user for running apps, set log directory, and point to the application's root directory.
```conf
server {
listen 3838;
# For root shiny server (in shinyapps user home folder)
location / {
# The shiny-server process would run by user `chrplr`
run_as chrplr;
# Save logs here
log_dir /var/log/shiny-server;
# Path to shiny server for separate apps
site_dir /home/chrplr/shiny-server;
# List contents of a (non-Shiny-App) directory when clients visit corresponding URIs
directory_index on;
}
# Allow users to host their own apps in `~/ShinyApps`
location /users {
run_as :HOME_USER:;
user_dirs;
}
}
```
--------------------------------
### Context Search with Specific Parameters
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Demonstrates context search with specific parameters for filtering and sorting results. Use when precise control over results is needed.
```javascript
function searchWithParams(query, context, filter, sortOrder) {
// Implementation with filtering and sorting
return results;
}
```
--------------------------------
### Syllabation de Lexique avec gawk
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/french-syllabation/README.md
Utilisez cette commande pour syllaber le fichier lexique260_graph.txt en utilisant le script syllabation.awk avec gawk. L'option -vphons=2 spécifie un paramètre pour le script.
```bash
gawk -vphons=2 -f syllabation.awk lexique260_graph.txt
```
--------------------------------
### Connect to Lexique Server and Pull Updates
Source: https://github.com/chrplr/openlexicon/blob/master/datasets-info/README-how-to-install-a-new-database.md
Connect to the lexique server via SSH and pull the latest changes for the shiny-server application.
```bash
cd ~chrplr/shiny-server
git pull
```
--------------------------------
### Count Lexicon Entries by Word Starting with a Letter
Source: https://github.com/chrplr/openlexicon/blob/master/documents/Interroger-Lexique-avec-R/interroger-lexique-avec-R.html
Counts words in the lexicon that begin with a specific letter. Case-insensitive.
```r
start_letter <- "b"
sum(grepl(paste0("^", start_letter), lexicon$X.LEXICAL_WORD., ignore.case = TRUE))
```
--------------------------------
### Context Search with Indexing and Re-indexing
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Demonstrates the process of indexing context data for search and re-indexing when data changes. Crucial for maintaining search relevance.
```javascript
function indexContextData(data) {
// Logic to index the provided data
}
function reindexContextData(updatedData) {
// Logic to update the index
}
```
--------------------------------
### Get Lexicon Entry by ID
Source: https://github.com/chrplr/openlexicon/blob/master/documents/Interroger-Lexique-avec-R/interroger-lexique-avec-R.html
Retrieves a specific lexicon entry using its unique identifier. Assumes an 'ID' column exists.
```r
id <- 12345
lexicon[lexicon$ID == id, ]
```
--------------------------------
### Get Unique POS Tags
Source: https://github.com/chrplr/openlexicon/blob/master/documents/Interroger-Lexique-avec-R/interroger-lexique-avec-R.html
Retrieves a list of all unique part-of-speech tags present in the lexicon. This helps understand the tag set.
```r
unique(lexicon$POS)
```
--------------------------------
### Tooltip Initialization and Basic Usage
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Initializes tooltips on elements and provides methods for showing, hiding, and toggling them. Requires jQuery and Bootstrap's tooltip JavaScript.
```javascript
var a=jQuery;
+function(a){ "use strict";
function b(b){ return this.each(function(){ var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;
(e||!/destroy|hide/.test(b))&&(e||d.data("bs.tooltip",e=new c(this,f)))
,"string"==typeof b&&e[b]()})
}
var c=function(a,b){this.init("tooltip",a,b)};
c.VERSION="3.3.5",c.TRANSITION_DURATION=150,c.DEFAULTS=a.extend({},{
animation:!0,
placement:"top",
selector:!1,
template:'
'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](
b
),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](
c
),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function
```
--------------------------------
### Get Category for a Specific Word in R
Source: https://github.com/chrplr/openlexicon/blob/master/documents/Interroger-Lexique-avec-R/interroger-lexique-avec-R.html
Shows how to retrieve the category associated with a given word from the lexicon. Useful for attribute lookup.
```r
lexicon$category[lexicon$word == "joy"]
```
--------------------------------
### jQuery AJAX Transport Interceptor Setup
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Helper function to set up interceptors for AJAX transports, allowing modification of request/response behavior.
```javascript
function Lb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}
```
--------------------------------
### jQuery Initialization and Basic Selection
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Demonstrates how to initialize jQuery objects from various inputs like HTML strings, DOM elements, or other jQuery objects. It also shows basic selection using CSS selectors.
```javascript
var x,y=a.document,z=/^(?:\s*(<[\w\W]+>[^>]*)|#([\w-]*))/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[
null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))}};A.prototype=m.fn,x=m(y);
```
--------------------------------
### Context Search with Query Parsing
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Shows how search queries are parsed into a format suitable for the search engine. Essential for understanding query structure.
```javascript
function parseSearchQuery(query) {
// Convert raw query string into structured query object
return parsedQuery;
}
```
--------------------------------
### JavaScript Function to Get Parent Node
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/lexical-frequencies/french-lexical-frequencies.html
This JavaScript function `pa` returns the parent node of a given element, used in selector traversal.
```javascript
function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}
```
--------------------------------
### Fetch Specific Datasets
Source: https://github.com/chrplr/openlexicon/blob/master/packages/openlexicon.fetcher/README.md
Loads or downloads specified lexical datasets. Ensure the 'openlexicon.fetcher' library is loaded before use.
```r
library(openlexicon.fetcher)
fetch_datasets(datasets = c("Lexique3", "Voisins", "Anagrammes") )
```
--------------------------------
### Get Context Function
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Defines a function to retrieve sentences from the corpus that contain a specific word. It uses the pre-built hashtable (environment) for efficient lookup.
```r
get.context <- function(word, envir=assoc) {
uscorpus[get(word, envir=envir)]
}
```
--------------------------------
### Get Lexicon Entries by Word Not Matching a Pattern
Source: https://github.com/chrplr/openlexicon/blob/master/documents/Interroger-Lexique-avec-R/interroger-lexique-avec-R.html
Filters lexicon entries for words that do NOT match a given regular expression. Useful for exclusion criteria.
```r
pattern <- "^a.*e$"
lexique_not_pattern <- lexicon[!grepl(pattern, lexicon$X.LEXICAL_WORD., ignore.case = TRUE), ]
head(lexique_not_pattern)
```
--------------------------------
### Generate JSON File using Python Script
Source: https://github.com/chrplr/openlexicon/blob/master/datasets-info/README-how-to-install-a-new-database.md
This command demonstrates how to use the `create_json.py` script to generate a JSON file for database descriptions. It takes database file names as arguments.
```bash
python3 create_json.py databasefile1.csv databasefile2.rds
```
--------------------------------
### Get Lexicon Entries with Specific Feature Combinations
Source: https://github.com/chrplr/openlexicon/blob/master/documents/Interroger-Lexique-avec-R/interroger-lexique-avec-R.html
Filters entries based on a combination of multiple feature columns. Useful for detailed linguistic analysis.
```r
lexique_complex_features <- lexicon[lexicon$GENDER == "F" & lexicon$NUMBER == "PL" & lexicon$CASE == "NOM", ]
head(lexique_complex_features)
```
--------------------------------
### Python Flask App Initialization
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Initializes a Flask application and defines the main execution block to run the server.
```Python
from flask import Flask, request, jsonify
app = Flask(__name__)
if __name__ == '__main__':
app.run(debug=True)
```
--------------------------------
### Get Lexicon Entries by Regular Expression
Source: https://github.com/chrplr/openlexicon/blob/master/documents/Interroger-Lexique-avec-R/interroger-lexique-avec-R.html
Filters lexicon entries using a regular expression for advanced pattern matching on words. Use with caution.
```r
pattern <- "^a.*e$"
lexique_regex <- lexicon[grep(pattern, lexicon$X.LEXICAL_WORD., ignore.case = TRUE), ]
head(lexique_regex)
```
--------------------------------
### Context Search with Stemming
Source: https://github.com/chrplr/openlexicon/blob/master/scripts/concordancer/context_search.nb.html
Demonstrates context search using stemming to match variations of a word (e.g., 'run', 'running', 'ran'). Improves recall.
```javascript
function searchWithStemming(query, context, options) {
// Apply stemming to query and/or context
return results;
}
```