Difference between revisions of "OpasnetUtils/Translate"
From Testiwiki
(→Rationale) |
(translate and dictionary updated) |
||
Line 16: | Line 16: | ||
<t2b name="Dictionary" index="Finnish,Swedish" obs="English" unit="-"> | <t2b name="Dictionary" index="Finnish,Swedish" obs="English" unit="-"> | ||
+ | Kerrostalot||Apartment houses | ||
+ | Rivitalot||Attached houses | ||
+ | Keskimääräinen päiväaktiivisuus (MW)||Average daily activity (MW) | ||
+ | Tätä menoa||BAU | ||
+ | Biopolttoaine||Biofuel | ||
+ | Biolämpölaitokset||Biofuel heat plants | ||
+ | Kerrostalo||Blocks of flats | ||
Rakennuttaja||Builders | Rakennuttaja||Builders | ||
+ | Rakennus||Building | ||
Rakennuksen omistaja||Building owner | Rakennuksen omistaja||Building owner | ||
− | + | Hoitolaitokset||Buildings for institutional care | |
− | + | Hiilineutraaliksi 2050||Carbon neutral 2050 | |
− | + | Yhdistetty tuotanto bioenergialla||CHP bio | |
− | + | CHP dieselgeneraattorit||CHP diesel generators | |
− | + | Kivihiili||Coal | |
− | |||
Kaupalliset||Commercial | Kaupalliset||Commercial | ||
+ | Kustannus||Cost | ||
+ | Datakeskusten lämpö||Data center heat | ||
+ | Päätös||Decision | ||
+ | Päätöksentekijä||Decision_maker | ||
+ | Syväporattu maalämpö||Deep-drill heat | ||
+ | Omakotitalot ja paritalot||Detached and semi-detached houses | ||
Omakotitalot||Detached houses | Omakotitalot||Detached houses | ||
+ | Hajautettu ja merilämpö||Distributed and sea | ||
+ | Kaukolämpö||District | ||
+ | Omaan käyttöön||Domestic | ||
Opetusala||Educational | Opetusala||Educational | ||
− | + | Opetusrakennukset||Educational buildings | |
− | + | Tehollinen vuotuinen rahavirta (Meur/a)||Effective annual cash flow (Meur/a) | |
− | + | Tehokkuus||Efficiency | |
− | + | Sähkö||Electricity | |
− | + | Verotettu sähkö||Electricity_taxed | |
− | + | Päästöt Helsingin lämmityksestä||Emissions from heating in Helsinki | |
− | + | Energiamuotojen virrat\nVoimalapäätös = BAU||Energy commodity flows \n Plant policy = BAU | |
− | + | Energiamuotojen virrat 2005\nVoimalapäätös = BAU||Energy commodity flows in 2005 \n Plant policy = BAU | |
− | + | Energiantuotantokapasiteetti voimalapäätöksen mukaan||Energy production capacity by plant policy | |
− | + | Kohtuullinen energiansäästö||Energy saving moderate | |
− | + | Täysi energiansäästö||Energy saving total | |
− | + | Energiansäästöpolitiikka||EnergySavingPolicy | |
− | + | Polttoaine||Fuel | |
− | + | Polttoöljy||Fuel oil | |
+ | Polttoaineiden hinnat (verolliset)||Fuel prices (with tax) | ||
+ | Maakaasu||Gas | ||
Yleinen||General | Yleinen||General | ||
− | + | Maalämpö||Geothermal | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Hanasaari||Hanasaari | Hanasaari||Hanasaari | ||
Hanasaari bio||Hanasaari biofuel renovation | Hanasaari bio||Hanasaari biofuel renovation | ||
+ | Terveys- ja sosiaaliala||Health and social sector | ||
+ | Terveysvaikutukset (DALY/a)||Health effects (DALY /a) | ||
+ | Lämpö||Heat | ||
+ | Lämmitys||Heating | ||
+ | Raskas polttoöljy||Heavy oil | ||
+ | Isot biolämpökeskukset||Helen proposition | ||
+ | Kotitalouden ilmastointi||Household air conditioning | ||
Kotitalouden ilmalämpöpumppu||Household air heat pumps | Kotitalouden ilmalämpöpumppu||Household air heat pumps | ||
− | |||
Kotitalouden maalämpö||Household geothermal heat | Kotitalouden maalämpö||Household geothermal heat | ||
Kotitalouden aurinkovoima||Household solar | Kotitalouden aurinkovoima||Household solar | ||
+ | Tulot ja menot voimaloittain||Incomes and costs by plant | ||
+ | Tulot ja menot voimalapäätöksen mukaan||Incomes and costs by plant policy | ||
+ | Teollisuus||Industrial | ||
+ | Teollisuusrakennukset||Industrial buildings | ||
Katri Vala viilennys||Katri Vala cooling | Katri Vala viilennys||Katri Vala cooling | ||
Katri Vala lämpö||Katri Vala heat | Katri Vala lämpö||Katri Vala heat | ||
Kellosaaren varavoimala||Kellosaari back-up plant | Kellosaaren varavoimala||Kellosaari back-up plant | ||
Kymijoen vesivoimalat||Kymijoki River's plants | Kymijoen vesivoimalat||Kymijoki River's plants | ||
+ | Mökki||Leisure houses | ||
+ | Kevytöljy||Light oil | ||
Loviisan ydinvoimalämpö||Loviisa nuclear heat | Loviisan ydinvoimalämpö||Loviisa nuclear heat | ||
+ | Matalaenerginen||Low-energy | ||
+ | Maksimikapasiteetti (MW)||Maximum capacity (MW) | ||
Nesteen öljyjalostamolämpö||Neste oil refinery heat | Nesteen öljyjalostamolämpö||Neste oil refinery heat | ||
+ | Uusi||New | ||
+ | Ei mitään||None | ||
+ | HUOM! Kaikissa kuvissa ja taulukoissa oletetaan täysi energiansäästö ellei erikseen mainita.\n||NOTE! In all graphs and tables, the Total energy saving policy is assumed unless otherwise noted\n | ||
+ | Toimistot||Offices | ||
+ | Öljy||Oil | ||
+ | Vanha||Old | ||
+ | Vaihtoehto||Option | ||
Muu||Other | Muu||Other | ||
− | + | Muut lähteet||Other sources | |
+ | Passiivitalo||Passive | ||
+ | Turve||Peat | ||
+ | Voimala||Plant | ||
+ | Voimalapolitiikka||PlantPolicy | ||
+ | Saaste||Pollutant | ||
+ | Sähköntuotanto, päivän keskiarvo (MW)||Power output daily average (MW) | ||
+ | Voimalan aktiivisuus lämpötilan mukaan, päiväoptimi\nenergian kohtuusäästö 2035||Power plant activity by temperature daily optim \nmoderate energy saving in 2035 | ||
+ | Voimalan aktiivisuus lämpötilan mukaan, päiväoptimi\nVoimalapäätös = tätä menoa, vuosi 2005||Power plant activity by temperature daily optim \nPlant policy = BAU, Year = 2005 | ||
+ | Voimalan aktiivisuus, päivän keskiarvo (MW)||Power plant activity daily average (MW) | ||
+ | Hinta (Eur/GWh)||Price (Eur/MWh) | ||
+ | Prosessilämpö||Process heat | ||
+ | Julkinen||Public | ||
+ | Korjaukset||Renovation | ||
+ | Rivitalot||Row houses | ||
Salmisaari biokorjaus||Salmisaari biofuel renovation | Salmisaari biokorjaus||Salmisaari biofuel renovation | ||
Merilämpö||Sea heat pump | Merilämpö||Sea heat pump | ||
Merilämpö viilennykseen||Sea heat pump for cooling | Merilämpö viilennykseen||Sea heat pump for cooling | ||
− | + | Seinät ja katto||Sheath reform | |
Pienet öljylämpölaitokset||Small fuel oil heat plants | Pienet öljylämpölaitokset||Small fuel oil heat plants | ||
Pienet kaasulämpölaitokset||Small gas heat plants | Pienet kaasulämpölaitokset||Small gas heat plants | ||
+ | Puun pienpoltto||Small-scale wood burning | ||
+ | Urheilu||Sports | ||
Suvilahden voimavaraaja||Suvilahti power storage | Suvilahden voimavaraaja||Suvilahti power storage | ||
Suvilahden aurinkovoima||Suvilahti solar | Suvilahden aurinkovoima||Suvilahti solar | ||
− | + | Taulukko 1. Kokonaistautitaakka DALY/a eri päätösvaihtoehtoyhdistelmissä.||Table 1: Total DALYs/a by different combinations of policy options. | |
+ | Tekniset||Techical systems | ||
+ | Lämpötila||Temperature | ||
+ | Päivän lämpötila||Temperature of the day | ||
+ | Aika||Time | ||
+ | Kokonaisvuosienergia (GWh/a)||Total annual energy (GWh/a) | ||
+ | Energiantuotannon kokonaiskustannus||Total costs of energy production | ||
+ | Kokonaistautitaakka DALY/a eri päätösvaihtoehtoyhdistelmissä.\n||Total DALYs/a by different combinations of policy options.\n | ||
+ | Perinteinen||Traditional | ||
+ | Liikennerakennukset||Transport and communications buildings | ||
+ | Vanhankaupungin voimala||Vanhakaupunki museum | ||
Vuosaari C bio||Vuosaari C biofuel | Vuosaari C bio||Vuosaari C biofuel | ||
+ | Varastot||Warehouses | ||
+ | Jäte||Waste | ||
Tuulivoimalat||Wind mills | Tuulivoimalat||Wind mills | ||
− | + | Ikkunat||Windows | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Puu||Wood | Puu||Wood | ||
− | + | Vuosikustannus (Meur)||Yearly costs (Meur) | |
− | + | Investointikielto||Zero investment | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</t2b> | </t2b> | ||
− | <rcode name="translate" label="Initiate translate (developers only)"> | + | <rcode name="dictionary" label="Ititiate dictionary (developers only)" embed=1> |
+ | ### This is code Op_en7392/dictionary) on page [[OpasnetUtils/Tranlate]]. | ||
+ | |||
+ | library(OpasnetUtils) | ||
+ | |||
+ | dictionary <- tidy(opbase.data("Op_en7392.dictionary")) | ||
+ | colnames(dictionary)[colnames(dictionary) == "Result"] <- "English" | ||
+ | objects.store(dictionary) | ||
+ | cat("Data.frame dictionary stored.\n") | ||
+ | |||
+ | </rcode> | ||
+ | |||
+ | <rcode name="translate" label="Initiate translate (developers only)" embed=1> | ||
### This is code Op_en7392/translate on page [[OpasnetUtils/Translate]]. | ### This is code Op_en7392/translate on page [[OpasnetUtils/Translate]]. | ||
Line 115: | Line 161: | ||
x, # object to be translated (ovariable, data.frame, or vector) | x, # object to be translated (ovariable, data.frame, or vector) | ||
lang = NULL, # language to translate to. | lang = NULL, # language to translate to. | ||
− | dict = NULL # | + | dict = NULL # rcode containing the dictionary |
) { | ) { | ||
if(is.null(lang)) if(exists("language")) lang <- language else lang <- "English" | if(is.null(lang)) if(exists("language")) lang <- language else lang <- "English" | ||
− | if(!is.null(dict) | !exists("dictionary")) { | + | EvalOutput(Ovariable("fetchdictionary", |
− | + | dependencies = data.frame( | |
− | + | Name = "dictionary", | |
− | + | Ident = if(is.null(dict)) "Op_en7392/dictionary" else dict | |
− | + | ), | |
+ | formula = function(...) return(0) | ||
+ | )) | ||
+ | # if(!is.null(dict) | !exists("dictionary")) { | ||
+ | # if(is.null(dict)) dict <- "Op_en7392.dictionary" | ||
+ | # dictionary <- tidy(opbase.data(dict)) | ||
+ | # colnames(dictionary)[colnames(dictionary) == "Result"] <- "English" | ||
+ | # } | ||
require(reshape2) | require(reshape2) | ||
dic <- melt(dictionary, id.vars = lang, value.name = "From") | dic <- melt(dictionary, id.vars = lang, value.name = "From") |
Revision as of 08:45, 5 October 2015
This page is a method.
The page identifier is Op_en7392 |
---|
Moderator:Jouni (see all) |
Give your opinion to the peer rating of the content of this page. |
Upload data
|
Question
How to automatically translate texts in ovariables and graphs from one language to another?
Answer
Use the translate function (will be put as a part of OpasnetUtils package at some point). It goes through index names and locations and replaces terms in one language with those of another. The matching terms must be given in a data.frame called dictionary, where each language has a column. If no dictionary exists, the t2b table from this page will be used.
Rationale
Data table for the default dictionary.
Obs | Finnish | Swedish | English |
---|---|---|---|
1 | Kerrostalot | Apartment houses | |
2 | Rivitalot | Attached houses | |
3 | Keskimääräinen päiväaktiivisuus (MW) | Average daily activity (MW) | |
4 | Tätä menoa | BAU | |
5 | Biopolttoaine | Biofuel | |
6 | Biolämpölaitokset | Biofuel heat plants | |
7 | Kerrostalo | Blocks of flats | |
8 | Rakennuttaja | Builders | |
9 | Rakennus | Building | |
10 | Rakennuksen omistaja | Building owner | |
11 | Hoitolaitokset | Buildings for institutional care | |
12 | Hiilineutraaliksi 2050 | Carbon neutral 2050 | |
13 | Yhdistetty tuotanto bioenergialla | CHP bio | |
14 | CHP dieselgeneraattorit | CHP diesel generators | |
15 | Kivihiili | Coal | |
16 | Kaupalliset | Commercial | |
17 | Kustannus | Cost | |
18 | Datakeskusten lämpö | Data center heat | |
19 | Päätös | Decision | |
20 | Päätöksentekijä | Decision_maker | |
21 | Syväporattu maalämpö | Deep-drill heat | |
22 | Omakotitalot ja paritalot | Detached and semi-detached houses | |
23 | Omakotitalot | Detached houses | |
24 | Hajautettu ja merilämpö | Distributed and sea | |
25 | Kaukolämpö | District | |
26 | Omaan käyttöön | Domestic | |
27 | Opetusala | Educational | |
28 | Opetusrakennukset | Educational buildings | |
29 | Tehollinen vuotuinen rahavirta (Meur/a) | Effective annual cash flow (Meur/a) | |
30 | Tehokkuus | Efficiency | |
31 | Sähkö | Electricity | |
32 | Verotettu sähkö | Electricity_taxed | |
33 | Päästöt Helsingin lämmityksestä | Emissions from heating in Helsinki | |
34 | Energiamuotojen virrat\nVoimalapäätös = BAU | Energy commodity flows \n Plant policy = BAU | |
35 | Energiamuotojen virrat 2005\nVoimalapäätös = BAU | Energy commodity flows in 2005 \n Plant policy = BAU | |
36 | Energiantuotantokapasiteetti voimalapäätöksen mukaan | Energy production capacity by plant policy | |
37 | Kohtuullinen energiansäästö | Energy saving moderate | |
38 | Täysi energiansäästö | Energy saving total | |
39 | Energiansäästöpolitiikka | EnergySavingPolicy | |
40 | Polttoaine | Fuel | |
41 | Polttoöljy | Fuel oil | |
42 | Polttoaineiden hinnat (verolliset) | Fuel prices (with tax) | |
43 | Maakaasu | Gas | |
44 | Yleinen | General | |
45 | Maalämpö | Geothermal | |
46 | Hanasaari | Hanasaari | |
47 | Hanasaari bio | Hanasaari biofuel renovation | |
48 | Terveys- ja sosiaaliala | Health and social sector | |
49 | Terveysvaikutukset (DALY/a) | Health effects (DALY /a) | |
50 | Lämpö | Heat | |
51 | Lämmitys | Heating | |
52 | Raskas polttoöljy | Heavy oil | |
53 | Isot biolämpökeskukset | Helen proposition | |
54 | Kotitalouden ilmastointi | Household air conditioning | |
55 | Kotitalouden ilmalämpöpumppu | Household air heat pumps | |
56 | Kotitalouden maalämpö | Household geothermal heat | |
57 | Kotitalouden aurinkovoima | Household solar | |
58 | Tulot ja menot voimaloittain | Incomes and costs by plant | |
59 | Tulot ja menot voimalapäätöksen mukaan | Incomes and costs by plant policy | |
60 | Teollisuus | Industrial | |
61 | Teollisuusrakennukset | Industrial buildings | |
62 | Katri Vala viilennys | Katri Vala cooling | |
63 | Katri Vala lämpö | Katri Vala heat | |
64 | Kellosaaren varavoimala | Kellosaari back-up plant | |
65 | Kymijoen vesivoimalat | Kymijoki River's plants | |
66 | Mökki | Leisure houses | |
67 | Kevytöljy | Light oil | |
68 | Loviisan ydinvoimalämpö | Loviisa nuclear heat | |
69 | Matalaenerginen | Low-energy | |
70 | Maksimikapasiteetti (MW) | Maximum capacity (MW) | |
71 | Nesteen öljyjalostamolämpö | Neste oil refinery heat | |
72 | Uusi | New | |
73 | Ei mitään | None | |
74 | HUOM! Kaikissa kuvissa ja taulukoissa oletetaan täysi energiansäästö ellei erikseen mainita.\n | NOTE! In all graphs and tables, the Total energy saving policy is assumed unless otherwise noted\n | |
75 | Toimistot | Offices | |
76 | Öljy | Oil | |
77 | Vanha | Old | |
78 | Vaihtoehto | Option | |
79 | Muu | Other | |
80 | Muut lähteet | Other sources | |
81 | Passiivitalo | Passive | |
82 | Turve | Peat | |
83 | Voimala | Plant | |
84 | Voimalapolitiikka | PlantPolicy | |
85 | Saaste | Pollutant | |
86 | Sähköntuotanto, päivän keskiarvo (MW) | Power output daily average (MW) | |
87 | Voimalan aktiivisuus lämpötilan mukaan, päiväoptimi\nenergian kohtuusäästö 2035 | Power plant activity by temperature daily optim \nmoderate energy saving in 2035 | |
88 | Voimalan aktiivisuus lämpötilan mukaan, päiväoptimi\nVoimalapäätös = tätä menoa, vuosi 2005 | Power plant activity by temperature daily optim \nPlant policy = BAU, Year = 2005 | |
89 | Voimalan aktiivisuus, päivän keskiarvo (MW) | Power plant activity daily average (MW) | |
90 | Hinta (Eur/GWh) | Price (Eur/MWh) | |
91 | Prosessilämpö | Process heat | |
92 | Julkinen | Public | |
93 | Korjaukset | Renovation | |
94 | Rivitalot | Row houses | |
95 | Salmisaari biokorjaus | Salmisaari biofuel renovation | |
96 | Merilämpö | Sea heat pump | |
97 | Merilämpö viilennykseen | Sea heat pump for cooling | |
98 | Seinät ja katto | Sheath reform | |
99 | Pienet öljylämpölaitokset | Small fuel oil heat plants | |
100 | Pienet kaasulämpölaitokset | Small gas heat plants | |
101 | Puun pienpoltto | Small-scale wood burning | |
102 | Urheilu | Sports | |
103 | Suvilahden voimavaraaja | Suvilahti power storage | |
104 | Suvilahden aurinkovoima | Suvilahti solar | |
105 | Taulukko 1. Kokonaistautitaakka DALY/a eri päätösvaihtoehtoyhdistelmissä. | Table 1: Total DALYs/a by different combinations of policy options. | |
106 | Tekniset | Techical systems | |
107 | Lämpötila | Temperature | |
108 | Päivän lämpötila | Temperature of the day | |
109 | Aika | Time | |
110 | Kokonaisvuosienergia (GWh/a) | Total annual energy (GWh/a) | |
111 | Energiantuotannon kokonaiskustannus | Total costs of energy production | |
112 | Kokonaistautitaakka DALY/a eri päätösvaihtoehtoyhdistelmissä.\n | Total DALYs/a by different combinations of policy options.\n | |
113 | Perinteinen | Traditional | |
114 | Liikennerakennukset | Transport and communications buildings | |
115 | Vanhankaupungin voimala | Vanhakaupunki museum | |
116 | Vuosaari C bio | Vuosaari C biofuel | |
117 | Varastot | Warehouses | |
118 | Jäte | Waste | |
119 | Tuulivoimalat | Wind mills | |
120 | Ikkunat | Windows | |
121 | Puu | Wood | |
122 | Vuosikustannus (Meur) | Yearly costs (Meur) | |
123 | Investointikielto | Zero investment |