【问题标题】:Combinations of English letters that are an English word out of 10,000 possible combinations [duplicate]10,000种可能组合中的英文单词的英文字母组合[重复]
【发布时间】:2018-12-25 06:18:10
【问题描述】:

我有一个由 4 个向量组成的 10000 个字母的小标题。我使用 tidyr 中的交叉函数制作了 tibble,它为我提供了所有可能的 4 字母组合。我想找到那些是英文单词的,所以我认为它需要阅读英文字典才能找到所有英文单词的 4 字母组合。

我在 Google 上搜索过。

library (tidyr)
a <- c('s', 'd', 'r',' h', 't', 'f', 'b', 'l', 'p', 'm')
b <- c('l', 'e', 'h', 'r', 'y', 'n', 'u', 'a', 'i', 'o')
c <- c('k', 'o', 'a', 't', 'e', 'l', 'n', 'i', 'r', 's')
d <- c('a', 'n', 't', 'e', 'p', 'y', 'l', 'd', 's', 'k')

lock <- crossing (a,b,c,d)

一瞥(锁定) 观察:10,000 变量:4

我想要一个我可以检查的英语组合列表。

【问题讨论】:

    标签: r combinations computation


    【解决方案1】:

    使用 -

    library(dplyr)
    library(qdapDictionaries)
    df <-  crossing (a,b,c,d) %>%
            mutate(x=paste(a,b,c,d, sep="")) %>%
            filter(x %in% GradyAugmented)
    

    您显然可以将GradyAugmented 替换为qdapDictionaries 中的任何其他单词列表(拉起?qdapDictionaries 以查看完整列表),或者您可以将其替换为任何其他包/自定义列表中的列表。

    > head(df)
    # A tibble: 6 x 5
      a     b     c     d     x    
      <chr> <chr> <chr> <chr> <chr>
    1 b     a     a     l     baal 
    2 b     a     a     s     baas 
    3 b     a     i     l     bail 
    4 b     a     i     t     bait 
    5 b     a     k     e     bake 
    6 b     a     l     d     bald 
    

    【讨论】:

    • 谢谢。我正在尝试打开多年前购买的 wordlock 自行车锁,但记不起密码了。
    猜你喜欢
    • 2010-10-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-01
    • 2020-06-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多