Read a file without no spaces

How to read any file say log file to get some meaningful information if all the spaces are removed from it?
For example, read this sentence as “Iamastudentofgolang” , “I am a student of go lang”

You can use

 b, err := ioutil.ReadFile("file.txt") // just pass the file name
    if err != nil {
        fmt.Print(err)
    }

    fmt.Println(b) // print the content as 'bytes'

    str := string(b) // convert content to a 'string'

I guess you can’t.

You can use Standard Library’s suffixarray for that. You need an algorithm though. Create a bunch of variations, then try to match them using an English dictionary. Or if you’re curious, use deep learning or something :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.