ModuleNotFoundError: No module named 'skimage'
时间: 2023-06-22 15:31:31 浏览: 57
这个错误通常是因为缺少 `scikit-image` 模块导致的。你可以使用以下命令安装 0;
for (int j = 0; j < reachable_set.len; j++) {
if (reachable_set.symbols[j] == rules[i].lhs) {
useful = 1;
break;
}
}
if (useful) {
for (int j = 0; j < rules[i].len; j++) {
char symbol = rules[i].rhs[j];
if (isupper(symbol)) {
int found = 0;
for (int k = 0; k < useful_set.len; k++) {
if (useful_set.symbols[k] == symbol) {
found = 1;
break;
}
}
if (!found) {
useful_set.symbols[useful_set.len++] = symbol;
}
} else {
int found = 0;
for (int k = 0; k < useful_set.len; k++) {
if (useful_set.symbols[k] == symbol) {
found = 1;
break;
}
}
if (!found) {
useful_set.symbols[useful_set.len++] = symbol;
}
}
}
}
}
}
// Step 3: Remove all useless symbols
for (int i = 0; i < *num_rules; i++) {
int useful = 1;
if (rules[i].lhs != 0) {
for (int j = 0; j < rules[i].len; j++) {
char symbol = rules[i].rhs[j];
if (isupper(symbol)) {
int found = 0;
for (int k = 0; k < useful_set.len; k++) {
if (useful_set.symbols[k] == symbol) {
found = 1;
break;
}
}
if (!found) {
useful = 0;
break;
}
}
}
if (!useful) {
rules[i].lhs = 0;
}
}
}
// Step 4: Remove all empty rules
int new_num_rules = 0;
for (int i = 0; i < *num_rules; i++) {
if (rules[i].lhs != 0) {
int empty = 1;
for (int j = 0; j < rules[i].len; j++) {
char symbol = rules[i].rhs[j];
if (isupper(symbol)) {
empty = 0;
break;
}
}
if (!empty) {
rules[new_num_rules++] = rules[i];
}
}
}
*num_rules = new_num_rules;
}
int main() {
Rule rules[MAX_RULES] = {
{'S', "AaBb", 4},
{'A', "BC", 2},
{'A', "a", 1},
{'B', "b", 1},
{'B', "e", 1},
{'C', "B", 1},
{'C', "c", 1},
};
int num_rules = 7;
printf("Before:\n");
for (int i = 0; i < num_rules; i++) {
print_rule(&rules[i]);
}
remove_epsilon_rules(rules, num_rules);
printf("After removing epsilon rules:\n");
for (int i = 0; i < num_rules; i++) {
print_rule(&rules[i]);
}
remove_unit_rules(rules, num_rules);
printf("After removing unit rules:\n");
for (int i = 0; i < num_rules; i++) {
print_rule(&rules[i]);
}
remove_useless_symbols(rules, &num_rules);
printf("After removing useless symbols:\n");
for (int i = 0; i < num_rules; i++) {
print_rule(&rules[i]);
}
return 0;
}
```
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)