我正在运行Windows 7 French,我正在尝试编译这个非常基本的程序,但Visual Studio很顽固并且拒绝遵守.我也尝试用Coliru上的GCC 4.7和Clang trunk编译它,我得到或多或少相同的错误(输出低于代码),虽然我认为Coliru在英文操作系统上运行所以我不希望它仍然可以工作.
我究竟做错了什么?我该如何解决?
#inclure <iostream>
ent principal(ent argn, ent** argm) // entier, nombre d'arguments, valeur des arguments
{
std::cendehors << "Bonjour le monde!\n";
renvoi SORTIE_SUCCÈS;
}
Run Code Online (Sandbox Code Playgroud)
principal.cpp:1:6: erreur: prétraitement de la directive invalide #inclure
#inclure <iostream>
^
principal.cpp:6:8: erreur: '\303' égaré dans le programme
renvoi SORTIE_SUCCÈS;
^
principal.cpp:6:8: erreur: '\210' égaré dans le programme
principal.cpp:3:5: erreur: «ent» ne désigne pas un type
ent principal(ent argn, ent** argm) // entier, nombre d'arguments, value …
Run Code Online (Sandbox Code Playgroud) 我正在从一个包含法语和英文字母的文件中读取数据.我试图构建一个包含所有可能的英文和法文字母的列表(存储为字符串).我使用下面的代码执行此操作:
# encoding: utf-8
def trackLetter(letters, line):
for a in line:
found = False;
for b in letters:
if b==a:
found = True
if not found:
letters += a
cur_letters = []; # for storing possible letters
data = urllib2.urlopen('https://duolinguist.wordpress.com/2015/01/06/top-5000-words-in-french-wordlist/', 'utf-8')
for line in data:
trackLetter(cur_letters, line)
# works if I print here
print cur_letters
Run Code Online (Sandbox Code Playgroud)
此代码打印以下内容:
['t','h','e','o','f','a','n','d','i','r','s','b',' y','w','u','m','l','v','c','p','g','k','x','j','z' ,'q','\ xc3','\ xa0','\ xaa','\ xb9','\ xa9','\ xa8','\ xb4','\ xae',' - ','\xe2','\ x80','\ x99','\ xa2','\ xa7','\ xbb','\ xaf']
尽管我指定了UTF编码,但显然法语字母在某种转换为ASCII时丢失了!奇怪的是当我直接打印出这一行(显示为评论)时,法语字符看起来很完美!
我该怎么做才能保留这些字符(é, è, ê, …
locale.setlocale(locale.LC_ALL, 'french')
在我的本地机器上工作(Windows 7 + Python 3)
locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8')
在我的另一台机器(Unix)上工作,但如果我在我的本地机器上使用它,我有这个错误:
locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8')' failed: unsupported locale setting
Run Code Online (Sandbox Code Playgroud) 我正在寻找pos_tag
法语句子的方法,如下面的代码用于英语句子:
def pos_tagging(sentence):
var = sentence
exampleArray = [var]
for item in exampleArray:
tokenized = nltk.word_tokenize(item)
tagged = nltk.pos_tag(tokenized)
return tagged
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 FastText 的法语预训练二进制模型(从官方FastText 的 github 页面下载)。我需要.bin
模型而不是.vec
词向量,以便近似拼写错误和词汇外的词。
但是,当我尝试加载所述模型时,使用:
from gensim.models import FastText
model = FastText.load_fasttext_format('french_bin_model_path')
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
NotImplementedError: Supervised fastText models are not supported
Run Code Online (Sandbox Code Playgroud)
令人惊讶的是,当我尝试加载英文二进制模型时,它工作得很好。
我正在运行 python 3.6 和 gensim 3.5.0。
欢迎任何关于为什么它不适用于法语矢量的想法!
例如,在这句话中,"评论声称?",句子中的问号和最后一个单词用空格分隔.
当法语文本写在一列中时,你经常会得到这样的东西:
Elle zigzague倒入empiétersurdes impostures
?杰奎琳门卫的机会.
换行发生在句子的最后一个单词和问号之间,这是不可取的.
Elle zigzague倒入empiétersurdes impostures
?杰奎琳门卫的机会.
有没有办法在纯CSS中解决这个问题?或者我们是否必须手动处理文本并将标点符号和单词包装在不间断的范围内?
我正在编写一个 php 代码,如下所示:
<?php <time datetime="<?php echo esc_attr(date_format($ts, 'H:i d-m-Y')) ?>"
data-timezone="<?php echo esc_attr($tz_param) ?>"><?php echo esc_html(date_format($ts, 'F j H:i')) ?></time> ?> // Line A
Run Code Online (Sandbox Code Playgroud)
A 行返回网页上的以下日期:
July 10 21:30
Run Code Online (Sandbox Code Playgroud)
print_r($ts)
印刷:
DateTime Object
(
[date] => 2019-07-10 21:30:00.000000
[timezone_type] => 3
[timezone] => America/New_York
)
July 10 21:30
Run Code Online (Sandbox Code Playgroud)
问题陈述:
我想知道我应该在上面 A 行的php 代码中进行哪些更改,以便当页面为 french时,它应该返回法语日期。
这是我尝试过的,但它仍然以英语返回日期。
<?php if(ICL_LANGUAGE_CODE=='fr'){
setlocale(LC_TIME, 'fr_FR');
?>
<time datetime="<?php echo esc_attr(date_format($ts, 'H:i d-m-Y')) ?>"
data-timezone="<?php echo esc_attr($tz_param) ?>"><?php …
Run Code Online (Sandbox Code Playgroud) 想用等效的ASCII替换单词中的所有法语字母.
letters = [['é', 'à'], ['è', 'ù'], ['â', 'ê'], ['î', 'ô'], ['û', 'ç']]
for x in letters:
for a in x:
a = a.replace('é', 'e')
a = a.replace('à', 'a')
a = a.replace('è', 'e')
a = a.replace('ù', 'u')
a = a.replace('â', 'a')
a = a.replace('ê', 'e')
a = a.replace('î', 'i')
a = a.replace('ô', 'o')
a = a.replace('û', 'u')
a = a.replace('ç', 'c')
print letters[0][0]
Run Code Online (Sandbox Code Playgroud)
é
但是,此代码打印.我怎样才能做到这一点?
我尝试获取以法国风格格式化的数字的双值。\n因此文本 1 003,25 应存储为值 (1003.25)。
\n\npublic class NumberFormatTest { \n public static void main(String[] args) throws ParseException {\n String db = "1003.25";\n String manualFRA = "1 003,25";\n double numberDB = Double.parseDouble(db);\n String ger = NumberFormat.getInstance(Locale.GERMAN).format(numberDB);\n String fra = NumberFormat.getInstance(Locale.FRENCH).format(numberDB);\n String eng = NumberFormat.getInstance(Locale.ENGLISH).format(numberDB);\n\n double gerD = NumberFormat.getNumberInstance(Locale.GERMAN).parse(ger).doubleValue();\n double fraD = NumberFormat.getNumberInstance(Locale.FRENCH).parse(fra).doubleValue();\n double mfraD = NumberFormat.getNumberInstance(Locale.FRENCH).parse(manualFRA).doubleValue();\n double engD = NumberFormat.getNumberInstance(Locale.ENGLISH).parse(eng).doubleValue();\n\n System.out.println("From database: " + db);\n\n System.out.println("\\tGerman: " + ger);\n System.out.println("\\tFrench: " + fra);\n System.out.println("\\tEnglish: " + eng);\n\n System.out.println("\\nTo Database: "); …
Run Code Online (Sandbox Code Playgroud) 我的代码:
with sr.Microphone() as source:
audio = r.listen(source)
try:
print("You said: " + r.recognize_google(audio) + "in french")
except sr.UnknownValueError:
print("Google Speech Recognition could not understand audio")
except sr.RequestError as e:
print("Could not request results from Google Speech Recognition service")
Run Code Online (Sandbox Code Playgroud)
我想将收听语言更改为法语。我该怎么做?
python speech-recognition python-3.x french google-speech-api
french ×10
python ×5
python-3.x ×3
ascii ×2
locale ×2
python-2.7 ×2
string ×2
c++ ×1
css ×1
date ×1
double ×1
fasttext ×1
gensim ×1
java ×1
nltk ×1
php ×1
pos-tagger ×1
punctuation ×1
windows ×1
wordpress ×1