Module talk:User:kc kennylau/ancestor chain

Latest comment: 6 years ago by Erutuon in topic Viewing part of the tree

This is really cool, not to mention useful. —Aryamanarora (मुझसे बात करो) 22:20, 11 February 2016 (UTC)Reply

@Aryamanarora: Thanks. --kc_kennylau (talk) 14:35, 12 February 2016 (UTC)Reply

Possible improvements edit

I wonder if this could be made into a combined ancestor/family chain, so that languages are grouped in families even if there is no proto-language for them. I imagine that working out the "parent" of a language in a branch would work as follows:

  1. If there is an ancestor specified for the language, use that.
  2. Otherwise, use the proto-language of the family.
  3. If the family has no proto-language, use the family directly.

When a family has a proto-language, perhaps both the family and its proto-language could be shown side by side. —CodeCat 01:27, 15 February 2016 (UTC)Reply

This is a great idea and one that I had intend to suggest in one form or another. —JohnC5 01:52, 15 February 2016 (UTC)Reply
I can suggest an improvement to this: If a family is given in the ancestor field, then treat it the same way with steps 2 and 3. --WikiTiki89 19:26, 17 February 2016 (UTC)Reply
Families can't be ancestors. If you want to specify the family, then specify it as family =. —CodeCat 20:06, 17 February 2016 (UTC)Reply
What I mean is, you should be able to get the same functionality both implicitly and explicitly. And the functionality I'm referring to is "When a family has a proto-language, perhaps both the family and its proto-language could be shown side by side". --WikiTiki89 20:19, 17 February 2016 (UTC)Reply
Yes, but it's not possible to fill in a family in the ancestor field. Only languages can go there. —CodeCat 20:58, 17 February 2016 (UTC)Reply
I know that it's not possible, that's why I'm saying that maybe it should be possible. --WikiTiki89 21:15, 17 February 2016 (UTC)Reply
The behavior has just been updated so that in the absence of an explicit ancestor, the language module uses its family's proto-language, if any. This has the exact same effect as what you are suggesting. —JohnC5 21:19, 17 February 2016 (UTC)Reply
Please read my comment of 20:19, 17 February 2016. --WikiTiki89 21:23, 17 February 2016 (UTC)Reply
Yes, it just seems redundant to me to mark it explicitly if it is calculated implicitly. —JohnC5 21:27, 17 February 2016 (UTC)Reply
Unless in a particular exceptional scenario we want the language's family to be different from the language's ancestor. Or, if we want to add multiple ancestors, such as we already do for some creole languages, we would want them to have the same functionality of displaying both the families and the ancestors. --WikiTiki89 16:36, 18 February 2016 (UTC)Reply
I agree with CodeCat, it's illogical to specify a family in the ancestor= rather than the family= field, especially because it seems like the only reason we'd be doing so would be to make this one page neater. - -sche (discuss) 22:18, 17 February 2016 (UTC)Reply

@kc kennylau, CodeCat: Could we possibly implement the “If the family has no proto-language, use the family directly” functionality here or does that need to be done in mod:languages? —JohnC5 15:22, 14 April 2016 (UTC)Reply

Oh no! edit

@kc kennylau, CodeCat: Could we make this more efficient, because we now have a problem of it overflowing the runtime limit. —JohnC5 19:51, 21 February 2016 (UTC)Reply

Did I break something? It all started after this edit. --Vahag (talk) 19:52, 21 February 2016 (UTC)Reply
@Vahagn Petrosyan: no, I think you are fine. This process it just staggeringly expensive, and its execution just takes too long. I'm wondering whether there might be a better algorithm that would be more efficient. —JohnC5 19:57, 21 February 2016 (UTC)Reply
Why is then Category:Lezghian languages in error? Does Kenneth's ancestor chain have anything to do with it? --Vahag (talk) 19:58, 21 February 2016 (UTC)Reply
@Vahagn Petrosyan: Yep, didn't even notice that. A language family may not have itself as its ancestor family. Thither lies infinite recursion. I'm not sure if I categorized it correctly though. —JohnC5 20:13, 21 February 2016 (UTC)Reply
You categorized correctly, thank you. Sorry, everybody, for breaking Wiktionary. --Vahag (talk) 20:17, 21 February 2016 (UTC)Reply
I'm still cleaning up from when I did it yesterday. Please continue! :)JohnC5 20:33, 21 February 2016 (UTC)Reply

Viewing part of the tree edit

Is there any way to just view part of the tree? My Lua is pretty bad. I've been reorganizing the New Indo-Aryan languages and this would be immensely useful. —Aryaman (मुझसे बात करो) 22:00, 16 November 2017 (UTC)Reply

@Erutuon, are you clever enough to get this module working again? I sure ain't. You can even edit my copy over at Module:User:JohnC5/Sandbox2. —JohnC5 22:12, 16 November 2017 (UTC)Reply
@JohnC5: Your version is now below the memory limit after Erutuon's edits. —Aryaman (मुझसे बात करो) 22:54, 16 November 2017 (UTC)Reply
Sweet, only 20 mb now! That's really impressive @Erutuon. —Aryaman (मुझसे बात करो) 22:55, 16 November 2017 (UTC)Reply
@AryamanA: Thanks! So, you would like to be able to make a tree of descendants for a specific language or family? I can work on that now. — Eru·tuon 23:05, 16 November 2017 (UTC)Reply
@Erutuon: I just suggested that in case the memory errors were unavoidable. User:AryamanA/sandbox2 is more than functional for me, thanks so much! —Aryaman (मुझसे बात करो) 23:06, 16 November 2017 (UTC)Reply
@AryamanA: Well, I thought it might be more convenient, since you are just working with one family. — Eru·tuon 23:19, 16 November 2017 (UTC)Reply
@Erutuon: For now I'm working with one family. I may also try to do something with the Iranian languages eventually. —AryamanA (मुझसे बात करेंयोगदान) 23:20, 16 November 2017 (UTC)Reply
@AryamanA: Well, now, if you want, you can give the code for the language whose descendants you want to display in the first parameter. — Eru·tuon 23:51, 16 November 2017 (UTC)Reply
@Erutuon: Thanks for fixing this up! Could I convince you to have this module show the intermediate language families without protolanguages (i.e. East Germanic, South Slavic, etc.)? Thanks! —JohnC5 06:06, 17 November 2017 (UTC)Reply
@JohnC5: I can try. I don't really understand how everything works yet. — Eru·tuon 07:08, 17 November 2017 (UTC)Reply
@Erutuon: Also, something that one of has done has made language get repeated twice, as in the case of Proto-Brythonic in Module:User:JohnC5/Sandbox2. :VJohnC5 09:45, 17 November 2017 (UTC)Reply
@JohnC5: It was table.remove, though I don't understand how... — Eru·tuon 10:08, 17 November 2017 (UTC)Reply
@Erutuon: Weird... —JohnC5 10:19, 17 November 2017 (UTC)Reply

Okay, now the tree shows language families if there's no proto-language – and it exceeds the template include size. There are still bugs: Romance is included alongside Latin under Proto-Italic, for instance. I guess the logic needs improvement. — Eru·tuon 03:49, 18 November 2017 (UTC)Reply

@Erutuon: Thank you so much! This is really helpful because we can now see language families that don't have a protolanguage, which formerly was not possible. It still does have a bug: If you look under Proto-Indo-European, it lists both the protolanguage and the language family, where is should only list one (the protoloanguage if it exists, else the family). It would also be cool if we could color or mark the family names differently from the languages. Thanks again. —JohnC5 20:23, 18 November 2017 (UTC)Reply
@JohnC5: You can customize the display of language families in the format function at the top of the module. There's a different return for regular languages, etymology languages, and language families. — Eru·tuon 20:27, 18 November 2017 (UTC)Reply
@Erutuon: Gotcha. And the double display of family and protolanguage? —JohnC5 22:20, 18 November 2017 (UTC)Reply
On second thought, the best option would be to display both the family and its protolanguage is they are both available. This way we can really see how the data is structured (i.e. whether Latin is coded as the protolanguage of Romance). —JohnC5 22:23, 18 November 2017 (UTC)Reply
@JohnC5: The creation of the tree is handled by find_ancestors, and because that returns "Proto-Italic" as the parent of both "Latin" and "Romance", both are included. Maybe creating a map from family to proto-language could be used to remove families if their proto-language is present.
I kind of do like having the families included, but it makes the tree so much bigger to have two nodes for family and proto-language. Maybe there should be both possibilities. — Eru·tuon 23:04, 18 November 2017 (UTC)Reply
@Erutuon: I like your adorable tree emoji. —JohnC5 02:11, 19 November 2017 (UTC)Reply

Okay, now you can use the second parameter to make the tree show families that have proto-languages: for instance, {{#invoke:User:JohnC5/Sandbox2|show|ine-pro|yes}}. — Eru·tuon 23:48, 19 November 2017 (UTC)Reply

Return to "User:kc kennylau/ancestor chain" page.