Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

LexicalCases

Guides

  • LexicalCases

Tech Notes

  • LexicalCases Overview

Symbols

  • BoundToken
  • CountSummaryLowercase
  • DataJoin
  • ExpandPattern
  • FormatLexicalPattern
  • HideMissing
  • LexicalCases
  • LexicalDispersionPlot
  • LexicalDispersionSmoothHistogram
  • LexicalMap
  • LexicalPattern
  • LexicalPatternQ
  • LexicalStructure
  • LexicalSummary
  • LexigramCount
  • MaxCategories
  • OptionalToken
  • Sandwich
  • StopWordQ
  • SynonymToken
  • TextType
  • ToLexicalPattern
  • TypeToken
  • WordToken
  • $FilterableProperties
  • $LexicalCasesServices
  • $SampleParagraph
  • $SampleSentence
  • $SampleStringExpression
FaizonZaman`LexicalCases`
LexicalPattern
​
LexicalPattern
[lp]
A wrapper for using lexical pattern
lp
in string functions
​
Details and Options

Examples  
(5)
Basic Examples  
(4)
Search for a
LexicalPattern
with
StringCases
In[1]:=
alice=ExampleData[{"Text","AliceInWonderland"}];
In[2]:=
StringCasesalice,
LexicalPattern
"Alice "~~
TypeToken
["Verb"]~~
TypeToken
["Adverb"]
Out[2]=
{Alice had not,Alice was not,Alice went back,Alice took up,Alice had no,Alice was soon,Alice could only,Alice looked all,Alice could not,Alice was more,Alice crouched down,Alice went timidly,Alice was just,Alice looked down,Alice had not,Alice got up,Alice was very,Alice looked up,Alice was too,Alice got up}
​
Find the string positions of a
LexicalPattern
In[1]:=
StringPositionalice,
LexicalPattern
"Alice"~~
TypeToken
["Verb"]~~
TypeToken
["Adverb"]
Out[1]=
{{1349,1361},{2548,2560},{3456,3468},{4360,4374},{8488,8500},{16084,16095},{18290,18303},{22528,22543},{25145,25160},{26380,26394},{29462,29475},{30448,30466},{32290,32307},{35021,35034},{35170,35186},{36142,36154},{38307,38318},{43702,43715},{44556,44570},{44958,44970},{51619,51630}}
​
Check if a string matches a
LexicalPattern
In[1]:=
StringMatchQ"Alice walked quickly",
LexicalPattern
"Alice"~~
TypeToken
["Verb"]~~
TypeToken
["Adverb"]
Out[1]=
True
​
Replace a lexical pattern in a string
In[1]:=
StringReplace"this is really cool!",
LexicalPattern
e:
TypeToken
["Adjective"]ToUpperCase[e]
Out[1]=
this is really COOL!
In[2]:=
StringReplace"this is really cool!",
LexicalPattern
e:
TypeToken
["Adjective"|"Adverb"]ToUpperCase[e]
Out[2]=
this is REALLY COOL!
Scope  
(1)

SeeAlso
StringCases
 
▪
StringPosition
 
▪
StringMatchQ
 
▪
LexicalCases
 
▪
StringReplace
TechNotes
▪
Lexical Cases Overview
RelatedGuides
▪
LexicalCases
RelatedLinks
▪
LexicalCases GitHub Repository
""

© 2025 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com