jp-dimension-parser is a simple parser useful for parsing dimension of a thing from unstructured text.
$ go get -u github.com/k-yomo/jp-dimension-parser
import (
"fmt"
"github.com/k-yomo/jp-dimension-parser/dimparser"
)
func main() {
dimensions := dimparser.Parse("幅62cm×奥行73cm×高さ189cm")
if dimensions != nil {
fmt.Println("width(cm):", dimensions.Width.Centimeter())
fmt.Println("depth(cm):", dimensions.Depth.Centimeter())
fmt.Println("height(cm):", dimensions.Height.Centimeter())
// => width(cm): 62
// => depth(cm): 73
// => height(cm): 189
}
}
More parsable formats are listed in the test code.