Questions tagged [lexical]

The "Lexical" tag is used to denote a connection with words of a language, its grammar or the dictionary. Alternatively, it is also used in the context of "lexical scope," the context in which certain values are valid.

Broadly, Lexical is used to refer to words of a language. (The terms in applicable to natural (human) languages, as well as to computer programming languages. Lexical is derived from "Lexicon" and therefore the tag is also applied to questions relating to the dictionary for a language.

Finally, the tag is used in a computer programming context: Lexical Scoping. A lexical scope is the "context" within with certain rules/values apply (Example the "scope" of a local variable.)

204 questions
168
votes
5 answers

Regular expression to match a word or its prefix

I want to match a regular expression on a whole word. In the following example I am trying to match s or season but what I have matches s, e, a, o and n. [s|season] How do I make a regular expression to match a whole word?
NMGod
  • 1,937
  • 2
  • 12
  • 11
159
votes
10 answers

Is there a JavaScript equivalent of the Python pass statement that does nothing?

I am looking for a JavaScript equivalent of the Python: pass statement that does not run the function of the ... notation? Is there such a thing in JavaScript?
guagay_wk
  • 26,337
  • 54
  • 186
  • 295
32
votes
7 answers

Java API for plural forms of English words

Are there any Java API(s) which will provide plural form of English words (e.g. cacti for cactus)?
Joe
  • 14,513
  • 28
  • 82
  • 144
30
votes
6 answers

Making a lexical Analyzer

I'm working with a Lexical Analyzer program right now and I'm using Java. I've been researching for answers on this problem but until now I failed to find any. Here's my problem: Input: System.out.println ("Hello World"); Desired…
KLoverated
  • 311
  • 1
  • 3
  • 6
25
votes
13 answers

Determine the difficulty of an english word

I am working a word based game. My word database contains around 10,000 english words (sorted alphabetically). I am planning to have 5 difficulty levels in the game. Level 1 shows the easiest words and Level 5 shows the most difficult words,…
Techtwaddle
  • 1,643
  • 1
  • 15
  • 11
19
votes
1 answer

How to break words into syllables in LaTeX correctly

I am writing my MSc with LaTeX and I have the problem that sometimes my words are divided in a wrong way. My language is spanish and I'm using babel package. How could I solve it? For example: propuestos appears prop-uestos (uestos in next line). It…
legami
  • 1,303
  • 6
  • 22
  • 31
19
votes
4 answers

The good, the bad, and the ugly of lexical $_ in Perl 5.10+

Starting in Perl 5.10, it is now possible to lexically scope the context variable $_, either explicitly as my $_; or in a given / when construct. Has anyone found good uses of the lexical $_? Does it make any constructs simpler / safer /…
Eric Strom
  • 39,821
  • 2
  • 80
  • 152
14
votes
1 answer

Common Lisp scoping (dynamic vs lexical)

EDIT: I changed the example code after the first answer because I came up with a simple version that begs the same questions. I am currently learning Common Lisp's scoping properties. After I thought I had a solid understanding I decided to code up…
Anthony Naddeo
  • 2,497
  • 25
  • 28
11
votes
5 answers

Why does Programming Perl use local (not my) for filehandles?

When I read through Programming Perl, 2nd Edition, Page 51, something confuses me : sub newopen { my $path = shift; local *FH; #not my! open (FH, $path) || return undef; return *FH; } $fh = newopen('/etc/passwd'); My I know, why…
Cheok Yan Cheng
  • 47,586
  • 132
  • 466
  • 875
11
votes
1 answer

How to parse sentences based on lexical content (phrases) with Python-NLTK

Can Python-NLTK recognize input string and parse it not only based on white space but also on the content? Say, "computer system" became a phrases in this situation. Can anyone provide a sample code? input String: "A survey of user opinion of…
user3381299
  • 177
  • 1
  • 7
9
votes
1 answer

Does Perl v5.18's sort understand lexical subroutines?

This is fixed in Perl v5.22. Does Perl v5.18's lexical subroutines with sort? I finally had a use for them today where I had a complicated sorting routine that depends on the current position in the data structure to look at deeper parts. Here's a…
brian d foy
  • 129,424
  • 31
  • 207
  • 592
8
votes
3 answers

How we can get html from editorState in Lexical rich editor?

I want to generate HTML format from editorState in Lexical Rich Editor, I'm able to get selection with editorState and what will be best to save into database, HTML or some sort of JSON format? and I want to show this HTML outside of editor. here is…
8
votes
1 answer

Syntax Highlighting / Lexical analysis Algorithms

What is the general algorithm used by a syntax highlighter? I have implemented a simple approach using alternation in regex: STRING_PATTERN|COMMENT_PATTERN|KEYWORD_PATTERNS Since detecting whether something is a string or a pattern depends on…
Aram Kocharyan
  • 20,165
  • 11
  • 81
  • 96
8
votes
1 answer

What is the difference between Lexical grammar and Syntactic grammar?

I am reading The Java Language Specification 8. I am trying to understand Chapter 2. Grammars. Here's what I have already learned: Semantics: Semantics is the study of meaning. Meaning: Meaning, in semantics, is defined as being Extension: The…
Rounak
  • 613
  • 3
  • 8
  • 22
7
votes
4 answers

Lexical Scope in JavaScript

I am slightly confused as to how exactly scope works in JavaScript, mainly lexical scope. I understand that variables in global scope are accessible anywhere, and the only way to create a new scope in JavaScript is through the creation of functions…
Anonymous
  • 95
  • 1
  • 10
1
2 3
13 14