Ich versuche, mehrere Kommentare in eine Matrix von Zeichen zu konvertieren, so dass ich Zahlen mit dem ultimativen Ziel extrahieren kann, ein zeichenbasiertes neuronales Netzwerk zu erstellen, um Beträge zu identifizieren. Es scheint, dass obwohl sie als Zeichen gespeichert sind, die ich mit strsplit verifizieren kann, die mstrsplit-Funktion von iotools sie nicht in eine Matrix einfügt.Verwenden von Mstrsplit zum Erstellen einer Zeichenmatrix
library("tm")
library("iotools")
sample1 <- "This is a number 2,000$ presented properly."
sample2 <- "This could be another representation $ 2,000."
sample3 <- "Often times there is 400 many $20 numbers 3.75$ in a single 1025.50 sentence."
sample4 <- "Frequently a data 21/02/2017 precedes a number 5 000 or follows it February 21, 2017."
sample5 <- "There are many 50 000 possible ways 20, 400$ that numbers can be presented."
sample6 <- "Creating an exhaustive list is probably impossible at 9:52 int he morning."
sample7 <- " use of different characters $ might be confusing."
text1 <- c(sample1, sample2, sample3, sample4, sample5, sample6, sample7)
text <- as.character(text1)
str(text)
characters <- strsplit(text, "")
text
characters
matrixc <- mstrsplit(characters, sep=NA)
matrixc
matrixc[1,19]
Danke für die Formatierung Frank. Auch fand ich eine Lösung verklagt Matrix (fehlende oder()). – CharlesBouwer